Monday, August 1, 2011

Create simple Ubuntu(Debian?) start up script

- Create a file at /etc/init.d/<filename>
#!/bin/bash

case "${1:-''}" in
'start')
# put the command to start
;;
'stop')
# stop command here
;;
'restart')
# restart command here
;;
*)
echo "Usage: $SELF start|stop|restart"
exit 1
;;
esac


sudo update-rc.d <filename> defaults


sudo /etc/init.d/<filename> <start|stop|restart>


- To remove
sudo rm /etc/rc*/*<filename>


Credit: Ivan in How do I make sphinx restart when I reboot my Ubuntu server?

No comments:

Clojure has lesser typing error problems than the others well-known dynamic typing languages

Give these snippets a try. // JS function foo () {   bar(1) } # Ruby def foo   bar(1) end ; Clojure (defn foo []    (bar 1)) As yo...