initctl version >= 1.4
/etc/init/sample.conf
description "sample"
start on runlevel [2345]
stop on runlevel [016]
setuid sampleuser
script
exec bash sample.sh
end script
respawn
initctl version < 1.4
/etc/init/sample.conf
description "sample"
start on runlevel [2345]
stop on runlevel [016]
script
exec bash sample.sh
exec su -s /bin/sh -c 'exec "$0" "$@"' sampleuser -- bash sample.sh
end script
respawn