Skip to content

Commit

Permalink
updated and added init.d and redis.conf files
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared Grippe authored and jaredatron committed Feb 25, 2012
1 parent b3c9f92 commit c583cfa
Show file tree
Hide file tree
Showing 3 changed files with 495 additions and 5 deletions.
11 changes: 6 additions & 5 deletions init.d/hobson
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@


PATH=/home/change/.rvm/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOBSON_ROOT=/home/change/hobson
HOBSON_CONFIG=/home/change/hobson/config.yml
PIDFILE=/home/change/hobson/hobson.pid
HOBSON="rvm use ruby-1.9.3-p0 do ruby /home/change/hobson_gem/bin/hobson work --pidfile $PIDFILE"
HOBSON_ROOT=/home/change/hobson_workspace
HOBSON_CONFIG=$HOBSON_ROOT/config.yml
PIDFILE=$HOBSON_ROOT/hobson.pid
USER=change
HOBSON="rvm use ruby-1.9.3-p0 do ruby ~/hobson/bin/hobson work --pidfile $PIDFILE"
NAME=hobson
DESC=hobson

Expand All @@ -33,7 +34,7 @@ case "$1" in
echo -n "Starting $DESC: "
touch $PIDFILE
chown change:change $PIDFILE
if start-stop-daemon --start --background --umask 007 --pidfile $PIDFILE --chuid change:change --exec /bin/bash -- -c "$HOBSON"
if start-stop-daemon --start --background --umask 007 --pidfile $PIDFILE --chuid $USER:$USER --exec /bin/bash -- -c "$HOBSON"
then
echo "$NAME."
else
Expand Down
72 changes: 72 additions & 0 deletions init.d/hobson-redis-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
# Description: redis-server - Persistent key-value db
### END INIT INFO


PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
USER=change
DAEMON=/usr/bin/redis-server
DAEMON_ARGS=/home/change/hobson_redis/redis.conf
NAME=hobson-redis-server
DESC=hobson-redis-server
PIDFILE=/home/change/hobson_redis/redis.pid

test -x $DAEMON || exit 0

set -e

case "$1" in
start)
echo -n "Starting $DESC: "
touch $PIDFILE
chown $USER:$USER $PIDFILE
if start-stop-daemon --start --quiet --umask 007 --pidfile $PIDFILE --chuid $USER:$USER --exec $DAEMON -- $DAEMON_ARGS
then
echo "$NAME."
else
echo "failed"
fi
;;
stop)
echo -n "Stopping $DESC: "
if start-stop-daemon --stop --retry forever/QUIT/1 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
then
echo "$NAME."
else
echo "failed"
fi
rm -f $PIDFILE
;;

restart|force-reload)
${0} stop
${0} start
;;

status)
echo -n "$DESC is "
if start-stop-daemon --stop --quiet --signal 0 --name ${NAME} --pidfile ${PIDFILE}
then
echo "running"
else
echo "not running"
exit 1
fi
;;

*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac

exit 0
Loading

0 comments on commit c583cfa

Please sign in to comment.