Skip to content

Instantly share code, notes, and snippets.

@amcgregor
Created September 16, 2019 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amcgregor/a11fd94a12b63fdb44ebe74221ff3ab5 to your computer and use it in GitHub Desktop.
Save amcgregor/a11fd94a12b63fdb44ebe74221ff3ab5 to your computer and use it in GitHub Desktop.
An example extremely minimal and silly "init.d script".
#!/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