Discussion:
[p4] Linux service script for P4DTG?
Bruce Mc
2013-10-05 01:10:01 UTC
Permalink
Posted on behalf of forum user 'Bruce Mc'.

Hello,

I'm looking for an /etc/init.d script so that I can add P4DTG as a service
with chkconfig. Does anyone out there know of one they can point me to?

I'm running on 64 bit Centos 6.4 and using Bugzilla 4.2.5 as our defect
tracker.

Thanks,

Bruce M



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2794-linux-service-script-for-p4dtg
P4Matt
2013-10-08 00:00:01 UTC
Permalink
Posted on behalf of forum user 'P4Matt'.

I don't know of any existing init.d scripts sadly. I can potentially advise
you on how to craft one; I've found myself in that world quite a bit
recently.



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2794-linux-service-script-for-p4dtg
McPeek, Bruce
2013-10-08 01:51:29 UTC
Permalink
Thank you Matt.

I'm pretty sure I can take an existing init.d script and use it as a template. The magic I'm looking for is the correct process for starting and stopping the executable. I believe there's a stop semaphore file involved in stopping it, so I'd like to make sure I get that piece right.

Any suggestion on reporting status?

Thanks,

Bruce M

-----Original Message-----
From: perforce-user-***@perforce.com [mailto:perforce-user-***@perforce.com] On Behalf Of P4Matt
Sent: Monday, October 07, 2013 5:00 PM
To: perforce-***@perforce.com
Subject: Re: [p4] Linux service script for P4DTG?


Posted on behalf of forum user 'P4Matt'.

I don't know of any existing init.d scripts sadly. I can potentially advise
you on how to craft one; I've found myself in that world quite a bit
recently.



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2794-linux-service-script-for-p4dtg
_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user
P4Karl
2013-10-08 08:30:01 UTC
Permalink
Posted on behalf of forum user 'P4Karl'.

Hi Bruce,

The following KB article includes a section on starting and stopping a P4DTG
replication mapping from the command line/script:

http://answers.perforce.com/articles/KB_Article/Configuring-P4DTG-without-a-GUI

To monitor the replication is running you can check:


- that that ' p4dtg-repl ' process is still running.

- that there are no " err-<MapName> " files in ' repl '
sub-directory.

- that there is a "run- <MapName>" file in the ' repl
' sub-directory.

- that the 'updated' value in the 'set- <MapName>.xml'
file in the 'config' sub-director y.


Hope that helps.

Karl



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2794-linux-service-script-for-p4dtg
Andrew DeFaria
2014-06-26 00:45:01 UTC
Permalink
Posted on behalf of forum user 'Andrew DeFaria'.

Here's mine:

#!/bin/bash # servicename=p4dtg # /etc/rc.d/init.d/$servicename # #
Perforce Defect Tracking Replication Service # # p4dtgr is a service that
replicates information between Perforce and a Defect # Tracking System such as
Bugzilla. # # The following is derived from Ubuntu, not sure if they all apply
to CentOS. # # Provides: p4dtgr # Required-Start: $network # Required-Stop:
none # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # chkconfig: 2345 70 30 #
Short-Description: Starts the P4DTG Replication Service # Description: The
Perforce Defect Tracking Gateway Recplication Service \ # replicates information
between Perforce and a DTS like \ # Bugzilla. # processname: p4dtg-repl # Source
function library. . /etc/init.d/functions
logfile=/var/log/${servicename}.log P4DTG=/opt/perforce/p4dtg
p4dtg_bin=p4dtg-repl MAPNAME=pf-test-bugs-dev export P4TICKETS=/root/.p4tickets
logmsg() { msg=$1 echo $msg echo $msg >> $logfile } #
logmsg logerr() { msg=$1 logmsg "ERROR: $1" exit 1 } #
logerr start() { echo -n "Starting $servicename: " if [ !
-d "$P4DTG" ]; then logerr "Unable to find P4DTG in
$P4DTG" fi cd "$P4DTG" # If p4dtg-repl is already
running then there's nothing for us to do if pidofproc $p4dtg_bin >
/dev/null; then logmsg "P4DTG Service is already running" exit fi # If
run file exists remove it, but only if p4dtg-repl is not already running rm -f
repl/run-$MAPNAME ./$p4dtg_bin $MAPNAME & if [ $?
!= 0 ]; then logerr "Unable to launch P4DTG service" else
logmsg "P4DTG Service started" fi touch
/var/lock/subsys/$servicename cd $OLDPWD return 0 } stop() { echo -n
"Shutting down $servicename: " if ! pidofproc $p4dtg_bin
/dev/null; then echo "P4DTG Service is NOT running" fi # Touch
the stop file touch "$P4DTG/repl/stop-$MAPNAME" # Wait a few
seconds for the daemon to notice sleep 2 # Check to see that it stopped if
pidofproc $p4dtg_bin > /dev/null; then logerr "P4DTG Service is
still running after stop was requested" else logmsg "P4DTG Service
stopped" fi rm -f /var/lock/subsys/$servicename return 0 } case
"$1" in start) start ;; stop) stop ;; status) if pidofproc
$p4dtg_bin > /dev/null; then echo P4DTG Service is running else echo
P4DTG Service is NOT running fi ;; restart) stop start ;; *) echo "Usage:
$servicename {start|stop|status|restart}" exit 1 ;; esac exit $?



--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/2794-linux-service-script-for-p4dtg
Loading...