[p4] starting p4d as a service via an init.d script

Tony Sweeney sweeney at addr.com
Thu Jul 27 02:08:36 PDT 2006


Tony Sweeney wrote:
> Jay Renbaum wrote:
>> Does anyone have an example script for starting p4d as a service on a
>> linux box using init.d?
>>
>>   
> OK, those attachments seem to have been garbled by Outlook -- lets try 
> Thunderbird...
OK, that looks better.  One last thing.  On Redhat, there is a utility 
called chkconfig that manages all the runlevel links in the rcX.d 
directories.  Check the manpage to see if your distro has it, and how to 
use it, or create the links by hand as you would on Solaris.

Tony.
>>  
>>   
> Tony.
>> Thanks,
>>
>>  
>>
>> Jay Renbaum
>>
>>  
>>
>> _______________________________________________
>> perforce-user mailing list  -  perforce-user at perforce.com
>> http://maillist.perforce.com/mailman/listinfo/perforce-user
>>
>>
>>   
>
> ------------------------------------------------------------------------
>
> #! /bin/sh
> #
> # p4d           Start the p4d daemon
> #
> # Author:       Tony Smith <tony at perforce.com>
> #
> # chkconfig: 345 85 15
> # description: Starts the Perforce server process
> #
> # processname: p4d
> # config: /etc/p4d.conf
> # Some junk to make the rc script behave
> # daemon  - makes rc startup work properly
> # killproc - makes rc shutdown work properly
>
>
> # Source function library.
> . /etc/init.d/functions
>
> RETVAL=0
>
> # See how we were called.
> case "$1" in
>   start)
>         echo -n "Starting Perforce server: "
>         daemon --check p4d --user perforce ". /etc/p4d.conf && p4d -C1 -d "
>         daemon --check p4web --user perforce "p4web -w 8080 -b &"
>         echo
>         touch /var/lock/subsys/p4d
>         ;;
>   stop)
>         echo -n "Stopping Perforce server: "
>         killproc p4d
> 	killproc p4web
>         rm /var/lock/subsys/p4d
>         echo
>         ;;
>   status)
> 	status p4web
>         status p4d
>         RETVAL=$?
>         ;;
>   restart)
>         $0 stop
>         $0 start
>         RETVAL=$?
>         ;;
>   *)
>         echo "Usage: p4d {start|stop|status|restart}"
>         exit 1
> esac
>
> exit $RETVAL
>   
> ------------------------------------------------------------------------
>
> #!/bin/sh
> #
>
> P4PORT=1666                     # defaults to localhost
> P4ROOT=/p4db
> P4_CKP_DIR=/p4jrnl/checkpoints  # someplace else than 
> P4LOG=/var/log/p4d              # play nice with logrotate
> P4JOURNAL=/p4jrnl/journal       # again, someplace else than 
>
> # set the real path for when we are called out of init.d/p4d
>
> PATH=/opt/Perforce/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
>
> export P4PORT P4ROOT P4LOG P4JOURNAL PATH
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>   



More information about the perforce-user mailing list