Reference link: http://askubuntu.com/questions/335242/how-to-install-an-init-d-script-in-ubuntu
For example, to create a new script “vncserver”
sudo editor /etc/init.d/vncserver
Then enter the shell script (e.g., define start, stop, status, etc. check out one example inside that folder…).
Afterwards, make sure that you make the script executable after creation.
sudo chmod +x /etc/init.d/vncserver
Now insert the service into the start-up system so that it runs at boot
sudo insserv vncserver
Now, test to see if it works
sudo service vncserver start
To stop it
sudo service vncserver stop