Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
cp "service.sh" "/etc/init.d/$YOUR_SERVICE_NAME"
chmod +x /etc/init.d/$YOUR_SERVICE_NAMEEdit the script and replace following tokens:
<NAME>=$YOUR_SERVICE_NAME<DESCRIPTION>= Describe your service here (be concise)- Feel free to modify the LSB header, I've made default choices you may not agree with
<COMMAND>= Command to start your server (for example/home/myuser/.dropbox-dist/dropboxd)<USER>= Login of the system user the script should be run as (for examplemyuser)
Start and test your service:
service $YOUR_SERVICE_NAME start
service $YOUR_SERVICE_NAME stopInstall service to be run at boot-time:
update-rc.d $YOUR_SERVICE_NAME defaultsEnjoy
Yep, I'm lazy too. But still, I've written a script to automate this :)
wget 'https://raw.github.com/gist/4275302/new-service.sh' && bash new-service.shIn this script I will download service.sh into a tempfile, replace some tokens, and then show you commands you should run as superuser.
If you feel confident enough with my script, you can sudo the script directly:
wget 'https://raw.github.com/gist/4275302/new-service.sh' && sudo bash new-service.shNote: the cool hipsterish curl $URL | bash won't work here, I don't really want to check why.
the script was not working because of a 404 on the service.sh so i forked it and made a proper repo out of it here:
https://github.com/jasonblewis/sample-service-script