LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Init Script for p4d not working (https://www.linuxquestions.org/questions/linux-newbie-8/init-script-for-p4d-not-working-277343/)

UglyWrangler 01-13-2005 10:43 AM

Init Script for p4d not working
 
I am trying to start p4d (the Perforce source code control server) with a script in init.d. My p4d startup script is listed below. I see the boot sequence try to start p4d and it indicates success: [OK], but when the login prompt appears the process is not running. From the command line the script works perfectly. What am I doing wrong?

# chkconfig: 345 90 20
# description: Perforce Server

P4ROOT=/var/local/perforce
P4JOURNAL=/var/local/perforce/journal
P4LOG=/var/local/perforce/logs/p4err
P4PORT=1666
P4USER=ggatling
P4PASSWD=****

case "$1" in
start)
p4d -r $P4ROOT -J $P4JOURNAL -L $P4LOG -p $P4PORT -d
;;
stop)
p4 -p$P4PORT -u$P4USER -P$P4PASSWD admin stop
;;
restart)
p4 -p$P4PORT -u$P4USER -P$P4PASSWD admin stop
p4d -r $P4ROOT -J $P4JOURNAL -L $P4LOG -p $P4PORT -d
;;
*)
printf "Usage: %s {start|stop|restart}\n" "$0"
exit 1
esac

exit 0

Oliv' 01-15-2005 08:05 AM

Hi,

The problem is that during init process, PATH is not set...
so it try to launch p4d (can't find it) but as it did the start statement it returns 0 as exit code so for Linux that's OK even if the process doesn't run :(
to correct that, just add the complete path to p4d, for example: /usr/bin/p4d -r $P4ROOT -J $P4JOURNAL -L $P4LOG -p $P4PORT -d

Oliv'

UglyWrangler 01-18-2005 10:45 AM

Oliv'

Your suggestion worked perfectly and explains why the script would work from the command line. Thanks so much for your help!

George


All times are GMT -5. The time now is 04:01 AM.