#!/bin/sh
#
# chkconfig: 345 86 14
# description: MyApp FCGI server
# pidfile: /var/run/myapp/pid
PATH=/sbin:/bin:/usr/bin:/usr/sbin
# Source function library.
. /etc/rc.d/init.d/functions
# Get config.
test -f /etc/sysconfig/network && . /etc/sysconfig/network
# Check that we are root ... so non-root users stop here
[ `id -u` = 0 ] || exit 1
# Check that networking is up.
[ "${NETWORKING}" = "yes" ] || exit 0
APP_HOME=/opt/myapp
RUN_DIR=/var/run/myapp
USER=myapprun
PID_FILE=$RUN_DIR/pid
SOCKET_FILE=$RUN_DIR/socket
SUBSYS_FILE=/var/lock/subsys/myapp
SCRIPT=$APP_HOME/script/myapp_fastcgi.pl
SCRIPT_ARGS="-l $SOCKET_FILE -p $PID_FILE -d"
# Check that the script is executable
[ -x $SCRIPT ] || exit 5
start(){
echo -n $"Starting myapp: "
daemon --user $USER $SCRIPT "$SCRIPT_ARGS >/dev/null 2>&1"
RETVAL=$?
echo
touch $SUBSYS_FILE
return $RETVAL
}
stop(){
echo -n $"Stopping myapp: "
killproc -p $PID_FILE myapp
RETVAL=$?
echo
rm -f $SUBSYS_FILE
return $RETVAL
}
restart(){
stop
start
}
condrestart(){
[ -e $SUBSYS_FILE ] && restart
return 0
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p $PID_FILE myapp
;;
restart)
restart
;;
condrestart)
condrestart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
RETVAL=1
esac
exit $RETVAL
Sunday, December 12, 2010
RHEL/Centos init script for a Catalyst FCGI server
UPDATE I've made a Gist
macbook, virtualbox and italian keyboard
I had problems with the italian keyboard when using virtualbox on my mac to run a windows guest, with some keys swapped... it was a very annoying issue (I need a lot my \ and < keys!) but I could easily solve it with this custom layout from the guys at life.innove.it. Thank you!
Subscribe to:
Comments (Atom)