Pita/etherpad-lite — Issue #324: Init Script on CentOS 5.5
Author: SteffanCline
Created: 2012-01-12 06:48:43+00:00
State: open

Not sure if this would be classified a bug or what... I have etherpad-lite working from the terminal just fine but when I try to execute use an init script in CentOS 5.5 I get a lot errors. Any suggestions on how to fix it?

Script here:

#!/bin/sh
#
# etherpad-lite - this script starts and stops the etherpad light daemon
#
# chkconfig: - 64 36
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 2 3 4 6
# Required-Start:
# description: etherpad lite is a collaboration editor
# processname: node
# config: /home/etherpad/etherpad-lite/settings.json
# pidfile: none
# lockfile: /var/lock/subsys/etherpad

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0

progname="Etherpad Lite"
path="/home/etherpad/etherpad-lite"
prog="/usr/bin/node"
parameter="server.js"
log="/var/log/etherpad/error.log"
conf="/home/etherpad/etherpad-lite/settings.json"
user="etherpad"
lockfile="/var/lock/subsys/etherpad"

logpath=$(dirname $log)

start() {
[ -x $prog ] || exit 5
[ -f $conf ] || exit 6
[ -d $logpath ] || mkdir $logpath
[ -f $log ] || touch $log
chown $user $logpath
chown $user $log

echo -n $"Starting $progname: "
cd $path
daemon --user=$user "$prog $parameter >>$log &"
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}

stop() {
echo -n $"Stopping $progname: "
killproc $prog
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}

restart() {
stop
start
}

rh_status() {
status $prog
}

rh_status_q() {
rh_status >/dev/null 2>&1
}

case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
status)
rh_status
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 2
esac

Errors:

[root@xxxx etherpad-lite]#
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module '/home/etherpad/etherpad-lite/server.js'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Array.0 (module.js:470:10)
at EventEmitter._tickCallback (node.js:192:40)