Skip to content

Instantly share code, notes, and snippets.

@jorke
Created June 2, 2016 03:19
Show Gist options
  • Save jorke/18d5bcc10f8da01505d446ddbbde6208 to your computer and use it in GitHub Desktop.
Save jorke/18d5bcc10f8da01505d446ddbbde6208 to your computer and use it in GitHub Desktop.
#! /bin/sh
# /etc/init.d/foobar
# The following part always gets executed.
echo "This part always gets executed"
# The following part carries out specific functions depending on arguments.
case "$1" in
start)
echo "Starting foobar"
echo "foobar is alive"
;;
stop)
echo "Stopping foobar"
echo "foobar is dead"
;;
*)
echo "Usage: /etc/init.d/foobar {start|stop}"
exit 1
;;
esac
exit 0
@jorke
Copy link
Author

jorke commented Jun 2, 2016

sudo chmod 755 /etc/init.d/foobar

sudo update-rc.d foobar default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment