Skip to content

Instantly share code, notes, and snippets.

@oranie
Created September 11, 2012 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save oranie/3697669 to your computer and use it in GitHub Desktop.
Save oranie/3697669 to your computer and use it in GitHub Desktop.
まだ変更途中のスクリプト
#!/bin/bash
#
# /etc/rc.d/init.d/growthforecast
#
# chkconfig: - 80 20
# description: growthforecast
# processname: growthforecast
# pidfile: /var/run/growthforecast/growthforecast.pid
#
### BEGIN INIT INFO
# Provides: growthforecast
# Default-Stop: 0 1 6
# Required-Start: $local_fs
# Required-Stop: $local_fs
### END INIT INFO
# Source function library.
. /etc/init.d/functions
name="growthforecast"
prog="growthforecast.pl"
PROG_PATH=/home/oranie/dev/GrowthForecast/$prog
LOG="/var/log/growthforecast.log"
DAEMON_ARGS=""
PROG_ARGS="--host 127.0.0.1 --front-proxy 127.0.0.1 --port 5125 >> $LOG 2>&1 "
start() {
if [ -f /var/lock/subsys/$prog ];then
echo "${prog} is runnig......"
exit
fi
echo -n "Starting $name: "
daemon $DAEMON_ARGS $PROG_PATH "$PROG_ARGS"
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
stop() {
echo -n "Shutting down $name: "
if [ -e "${PIDFILE}" ]; then
killproc -p ${PIDFILE} || killproc $prog
else
killproc $prog
fi
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $PIDFILE && rm -f /var/lock/subsys/$prog
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
killproc $td_agent -HUP
;;
condrestart)
[ -f /var/lock/subsys/$prog ] && restart || :
;;
status)
status $td_agent
;;
*)
echo "Usage: $prog {start|stop|reload|restart|condrestart|status}"
exit 1
;;
esac
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment