-
-
Save danbeaulieu/a4f4196188ac81189260 to your computer and use it in GitHub Desktop.
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
## Inside /etc/init.d | |
#!/bin/sh | |
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11" | |
start() { | |
if [ "${USE_DOCKER}" ]; then | |
start my_service | |
else | |
/opt/scripts/start.sh | |
fi | |
} | |
stop() { | |
} | |
case "$1" in | |
start) | |
echo -n "Starting: " | |
start | |
;; | |
stop) | |
echo -n "Stopping: " | |
stop | |
;; | |
****) | |
echo "Usage: /etc/init.d/$NAME {start|stop}" | |
exit 1 | |
;; | |
esac | |
exit 0 | |
## Inside /etc/init | |
description "Docker container" | |
author "Me" | |
stop on runlevel [!2345] | |
respawn | |
script | |
# Wait for docker to finish starting up first. | |
FILE=/var/run/docker.sock | |
while [ ! -e $FILE ] ; do | |
inotifywait -t 2 -e create $(dirname $FILE) | |
done | |
/usr/bin/docker run -i -t -rm ubuntu bash | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment