Ubuntu (12.04) upstart (at boot) services

Creating your own ubuntu upstart service:

  • Create a shell script. (Name it whatever you want. Here I am assuming it to be “autorun.sh”)
    vi autorun.sh
    
  • Copy the shell script to /etc/init.d/
    sudo cp autorun.sh /etc/init.d/autorun.sh
    
  • Make the script executable.
    sudo chmod +x /etc/init.d/autorun.sh
    
  • Update the upstart table of ubuntu by creating symbolic links.
    sudo update-rc.d autorun.sh defaults
    
  • Done.

To boot an already existing script:

  • Update the upstart table of ubuntu by creating symbolic links.
    sudo update-rc.d service_name defaults
    
  • Enable a disabled upstart service
    sudo update-rc.d service_name enable
    

To remove a script from upstart:

  1. (option-1)
    update the table and remove the script(not necessary)
    sudo update-rc.d -f autorun.sh remove
    sudo rm /etc/init.d/autorun.sh (optional)
    
  2. (option-2)
    Disable the service from boot
    sudo update-rc.d -f autorun.sh disable
    
  3. (option-3)
    if there is a configuration file for the script in /etc/init/
    sudo echo 'manual' | /etc/init/scriptname.override
    sudo update-rc.d -f scriptname remove
    

Reference: ubuntu upstart cookbook