Created
April 25, 2014 03:10
-
-
Save yuttie/11276684 to your computer and use it in GitHub Desktop.
An init script for Redmine
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 | |
# | |
# redmine Redmine | |
# | |
# chkconfig: 2345 80 30 | |
# description: Postfix is a Mail Transport Agent, which is the program \ | |
# that moves mail from one machine to another. | |
# processname: thin | |
# pidfile: /var/run/redmine.pid | |
### BEGIN INIT INFO | |
# Provides: redmine | |
# Required-Start: $local_fs $network $remote_fs | |
# Required-Stop: $local_fs $network $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: start and stop redmine | |
# Description: Redmine. | |
### END INIT INFO | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
# Source networking configuration. | |
. /etc/sysconfig/network | |
RETVAL=0 | |
prog="redmine" | |
lockfile=/var/lock/subsys/$prog | |
pidfile=/var/run/redmine/$prog.pid | |
status -p $pidfile -l $(basename $lockfile) -b /usr/bin/thin thin >/dev/null 2>&1 | |
start() { | |
# Check that networking is up. | |
[ ${NETWORKING} = "no" ] && exit 1 | |
# Start daemons. | |
echo -n $"Starting $prog: " | |
su - redmine -c "/usr/bin/thin start --port 443 --chdir /home/redmine/redmine-2.5.1 -e production --ssl --ssl-key-file server.key --ssl-cert-file server.crt --user redmine --group redmine --daemonize --pid $pidfile" && success || failure $"$prog start" | |
RETVAL=$? | |
[ $RETVAL -eq 0 ] && touch $lockfile | |
echo | |
return $RETVAL | |
} | |
stop() { | |
# Stop daemons. | |
echo -n $"Shutting down $prog: " | |
/usr/bin/thin stop --user redmine --group redmine --pid $pidfile && success || failure $"$prog stop" | |
RETVAL=$? | |
[ $RETVAL -eq 0 ] && rm -f $lockfile | |
echo | |
return $RETVAL | |
} | |
# See how we were called. | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart|force-reload) | |
stop | |
start | |
;; | |
status) | |
status -p $pidfile -l $(basename $lockfile) -b /usr/bin/thin thin | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|restart|status}" | |
exit 2 | |
esac | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment