Last active
October 22, 2016 01:12
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PROCESS_NAME='[j]upyter-notebook' | |
pid=`ps aux | grep $PROCESS_NAME | awk '{print $2}'` | |
kill -9 $pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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