Buy Me a Coffee

Thursday, November 17, 2011

How to run script as service in ubuntu


In order to run a script as a service which will run on boot time do the followings:

create the script and add the commands in to it using vi:
  sudo vi /etc/init.d/SCRIPT_NAME

Change the run level of the script so it could be executable file
  sudo chmod +x /etc/init.d/SCRIPT_NAME

Run update-rc.d in order to create the links:
  sudo update-rc.d SCRIPT_NAME defaults 80

more information can be found at:
https://help.ubuntu.com/community/UbuntuBootupHowto