I need the service to automatically start upon boot, it does not require console access for a start. Ofcause it would be nice to be able to produce some output for logging/debugging/stats. But for now, I just need a "TCP listener" that runs in the background, written in C#/mono.

Anyone in here able to show me how you install a service in Debian?

So this program isnt visible, its just like a "daemon" or cron perhaps. Cant figure out where to put it and how to initiate it.

  • cron is a daemon ;)
    – goldilocks
    Commented Feb 27, 2013 at 17:35
  • How did you get on with this? What did you end up doing?
    – Madivad
    Commented Apr 12, 2019 at 12:12

3 Answers 3


Create an init.d script to run your application

you can run the mono service in linux OS by using the command mono-service [options] program.exe call this from an init.d sript

Check this man page for more details about running mono service on linux http://linux.die.net/man/1/mono-service

  • cool will try to check that out Commented Feb 27, 2013 at 23:15

If you don't want to write a debian style sysv init script (see /etc/init.d/README), you can just append a line to /etc/rc.local, eg:

/full/path/to/myprogram &

The full path is necessary as $PATH may not be properly set for rc.local when it is run at boot (but it will be for "myprogram").

The & just backgrounds the process, allowing rc.local to continue and exit. "myprogram" is now running owned by root. That may be desirable if you want to open a low number privileged (server) port at start-up; for security the process should subsequently switch (effective) user id (euid/uid).

If you don't need root privileges at all:

/bin/su [user] -c /full/path/to/myprogram &
  • aha! interesting too! going to check tomorrow too. Commented Feb 27, 2013 at 23:16

you can create init.d script and use start-stop-daemon together with nohup to start your app in the background. Here is an example with kestrel web server (which is eventually run with mono). Just change \"$DNXRUNTIME\" kestrel > \"$LOGFILE\" to your command line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.