Upstart example script
Operation systems that still not use systemd probably use upstart.
Here is example script, e.g. /etc/init/yourapp.conf:
description "your app description"
start on runlevel [2345]
stop on runlevel [06]
respawn
exec bash /srv/yourapp/run.sh
Sh script: /srv/yourapp/run.sh
#!/bin/bash
# you can do some actions here
# and start daemon process e.g.:
uwsgi --ini /srv/yourapp/uwsgi.ini
Then you can do:
| Start | Stop | Restart |
|---|---|---|
service yourapp start |
service yourapp stop |
service yourapp restart |