Created
December 11, 2013 14:32
-
-
Save FeroVolar/7911366 to your computer and use it in GitHub Desktop.
Redmine init.d script for Debian
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: redmine | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: redmine webrick | |
# Description: redmine webrick server autostart-script | |
### END INIT INFO | |
. /lib/lsb/init-functions | |
# Modify it to your configuration | |
DIR=/path/to/redmine/ | |
# Start Redmine in daemon mode. | |
start(){ | |
log_daemon_msg "Starting Redmine WebRick" | |
cd $DIR | |
log_progress_msg | |
ruby script/rails server webrick -d -e production &> /dev/null | |
# ruby script/server -d -e production &> /dev/null | |
log_progress_msg | |
log_end_msg 0 | |
} | |
# Stop Redmine daemon | |
stop(){ | |
log_daemon_msg "Stopping Redmine WebRick" | |
RUBYPID=`ps aux | grep "ruby script/rails server webrick -d -e production" | grep -v grep | awk '{print $2}'` | |
log_progress_msg | |
if [ "x$RUBYPID" != "x" ]; then | |
kill -2 $RUBYPID | |
fi | |
log_end_msg 0 | |
} | |
# Check if Redmine is running | |
status(){ | |
RUBYPID=`ps aux | grep "ruby script/rails server webrick -d -e production" | grep -v grep | awk '{print $2}'` | |
if [ "x$RUBYPID" = "x" ]; then | |
echo "* Redmine is not running" | |
else | |
echo "* Redmine is running" | |
fi | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
status) | |
status | |
;; | |
restart|force-reload) | |
stop | |
start | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|force-reload|status}" | |
exit 1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment