Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init Script on CentOS 5.5 #324

Closed
SteffanCline opened this issue Jan 12, 2012 · 3 comments
Closed

Init Script on CentOS 5.5 #324

SteffanCline opened this issue Jan 12, 2012 · 3 comments

Comments

@SteffanCline
Copy link

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)

Is it a bad parameter handed off to node?

@SteffanCline
Copy link
Author

Sorry... not sure how to format that better...

@booo
Copy link
Contributor

booo commented Jan 15, 2012

Are you sure you want to execute /home/etherpad/etherpad-lite/server.js and not /home/etherpad/etherpad-lite/node/server.js?

Markdown Flavor of github is explained here: http://github.github.com/github-flavored-markdown/ ;)

@SteffanCline
Copy link
Author

Yeah, I found that mistake in the init script and it started working. Now to debug a crash posted on another thread. Bug can be closed.

#!/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/node"
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: "
        daemon --user=$user "cd $path; $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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants