Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i have this startup script under fedora running fine

#!/bin/sh -e

export P4JOURNAL=/var/log/perforce/journal
export P4LOG=/var/log/perforce/p4err
export P4ROOT=/var/local/perforce
export P4PORT=1666

PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"

p4start="p4d  -d"
p4stop="p4  admin stop"
p4user=perforce


case "$1" in
start)

#NOTE: in original, havent found RedHat equiv or source to include
# Havent found . /lib/lsb/init-functions
#log_action_begin_msg "Starting Perforce Server"
echo "starting perforce server from script..."
$p4start;
;;

stop)
# see above
#log_action_begin_msg "Stopping Perforce Server"
echo "stoping perforce server from script"
$p4stop;
;;

restart)
 $p4stop;
 $p4start;
;;

*)
echo "Usage: /etc/init.d/perforce (start|stop|restart)"
exit 1
;;

esac

but it won't work at ubuntu, not sure what went wrong.(p4d and p4 are both in /usr/local/bin)

Any help will be appreciated.

i got this using sh -x

starting perforce server from script...
+ p4d -d
+ exit 0

the result seems right, but p4d not running.

share|improve this question
    
Does it error? What happens if you run it with 'sh -x'? That should show you what is happening step-by-step. –  Jed Daniels Sep 16 '10 at 22:25
    
'sh -x' result posted, thanks –  Weiwei Sep 16 '10 at 22:29
    
Well, it looks like there is nothing wrong with your script. Does "p4d -d" work the way you are expecting when you run it by hand? If so, then my guess is that some environment variables or path information doesn't have enough information for p4d to do the right thing (or has the wrong information). –  Jed Daniels Sep 16 '10 at 23:31
    
thanks Jed, it was command problem –  Weiwei Sep 17 '10 at 0:13
    
Great. I'm going to repost that last comment as an answer. Thanks. –  Jed Daniels Sep 17 '10 at 2:02

1 Answer 1

up vote 1 down vote accepted

It looks like there is nothing wrong with your script. Does "p4d -d" work the way you are expecting when you run it by hand? If so, then my guess is that some environment variables or path information doesn't have enough information for p4d to do the right thing (or has the wrong information).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.