Skip to content

Instantly share code, notes, and snippets.

@pvanheus
Created December 4, 2015 15:17
Show Gist options
  • Save pvanheus/31dc967d5713a2a79c9d to your computer and use it in GitHub Desktop.
Save pvanheus/31dc967d5713a2a79c9d to your computer and use it in GitHub Desktop.
#!/bin/bash
### BEGIN INIT INFO
# Provides: galaxy
# Required-Start: $network $local_fs $mysql $supervisord
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Galaxy
### END INIT INFO
. /lib/lsb/init-functions
GALAXY_USER="galaxy"
GALAXY_HOME="/opt/galaxy"
GALAXY_VENV=$GALAXY_HOME/.venv
SUPERVISORCTL="$GALAXY_VENV/bin/supervisorctl"
case "${1:-''}" in
'start')
log_daemon_msg "Starting Galaxy"
su -c "cd $GALAXY_HOME && $SUPERVISORCTL start all" $GALAXY_USER
log_end_msg $?
;;
'stop')
log_daemon_msg "Stopping Galaxy"
su -c "cd $GALAXY_HOME && $SUPERVISORCTL stop all" $GALAXY_USER
log_end_msg $?
;;
'restart')
# restart commands here
$0 stop
sleep 1
$0 start
;;
'status')
su -c "cd $GALAXY_HOME && $SUPERVISORCTL status" $GALAXY_USER
;;
*) # no parameter specified
echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment