Created
September 16, 2019 21:22
-
-
Save amcgregor/a11fd94a12b63fdb44ebe74221ff3ab5 to your computer and use it in GitHub Desktop.
An example extremely minimal and silly "init.d script".
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 | |
ENV=production | |
BASE=/home/application | |
cd ${BASE} # Could also slap /${ENV} on there, if that's how you're structuring. | |
# Activate the virtual environment. Alter to taste. | |
source ${BASE}/bin/activate | |
# Apply local role-based configuration / "env file". | |
# http://12factor.net/config | |
source env/${ENV}.env # Minor sec. warning, this is eval'ing the file, not running through "env". | |
function start() { | |
# do the needful | |
} | |
function stop() { | |
# disturb the calm | |
} | |
function status() { | |
# as of a great many application workers, crying out in unison | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status | |
;; | |
restart) | |
stop | |
start | |
;; | |
*) | |
echo "Usage: $0 {start|stop|status|restart}" | |
exit 1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment