Skip to content

Instantly share code, notes, and snippets.

@camilosampedro
Last active October 22, 2016 01:12
Show Gist options
  • Save camilosampedro/1fb81ddc9b100344f1c0 to your computer and use it in GitHub Desktop.
Save camilosampedro/1fb81ddc9b100344f1c0 to your computer and use it in GitHub Desktop.
Schema of how to create a script's daemon on /etc/init.d/
#!/bin/bash
### BEGIN INIT INFO
# Provides: start-hadoop
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start Jupyter Notebook's service
# Description: Executes jupyter notebook in background.
### END INIT INFO
case $1 in
start)
/bin/bash "$ROUTE_TO_PROGRAM_STARTER"
;;
stop)
/bin/bash "$ROUTE_TO_PROGRAM_KILLER"
;;
restart)
/bin/bash "$ROUTE_TO_PROGRAM_KILLER"
/bin/bash "$ROUTE_TO_PROGRAM_STARTER"
;;
esac
exit 0
#!/bin/bash
PROCESS_NAME='[j]upyter-notebook'
pid=`ps aux | grep $PROCESS_NAME | awk '{print $2}'`
kill -9 $pid
#!/bin/bash
# Start instruction. Examples:
# /bin/echo "Hello world!"
# java -jar $ROUTE_TO_JAR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment