vNextIn the previous article I've used nohup + su + init.d script to run kestrel in a background. But as Daniel Lo Nigro suggested in comments it's much easier to do the same with Supervisor

And he was absolutelly right, config is much smaller, and you can easelly see status and output of a program.

First, install supervisor:

sudo apt-get install supervisor

Now you can create config for your application:

sudo nano /etc/supervisor/conf.d/kestrel_default.conf

With following content:

command=su -c "/home/username/.k/runtimes/kre-mono.1.0.0-beta3/bin/k kestrel" username

Specify path to your dnx and application, as well as username under which you want to run your application (usually user who has dnx installed)

Now you can tell supervisor to reread configurations:

sudo supervisorctl reread
sudo supervisorctl update

This command will automaticaly start your application (we specified autostart=true in config).

To see current status and start\stop applications execute:

sudo supervisorctl

There you can stop application:

stop kestrel_default


start kestrel_default

Or check program's output:

tail kestrel_default