p4dtg_instance_init.template #1

  • //
  • guest/
  • trina/
  • sdp/
  • main/
  • Server/
  • Unix/
  • p4/
  • common/
  • etc/
  • init.d/
  • p4dtg_instance_init.template
  • View
  • Commits
  • Open Download .zip Download (1 KB)
#!/bin/bash
#==============================================================================
# Copyright and license info is available in the LICENSE file included with
# the Server Deployment Package (SDP), and also available online:
# https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE
#------------------------------------------------------------------------------
#
# P4DTG server init script

# p4dtg Init Script.
# chkconfig: - 90 30
# description: P4DTG Start Up Script

export TMP=$P4TMP

source /p4/common/bin/p4_vars REPL_SDP_INSTANCE || exit 1

if [[ `$ID -u` = 0 ]]; then
 exec su - $OSUSER -c "$0 $1"
elif [[ "`$ID -u -n`" != $OSUSER ]]; then
 echo "$0 can only be run by root or $OSUSER"
 exit 1
fi

cd $P4DTG_ROOT
if [[ $? -ne 0 ]]; then
  echo "The P4DTG_ROOT directory [$P4DTG_ROOT] does not exist."
  exit 1
fi

# Souce in get_pids().
source $P4CBIN/ps_functions.sh || exit 1

# See how we were called.
case "${1:-status}" in
  start)
     $P4DTGBIN $P4DTG_CFG $P4DTG_ROOT &
  ;;

  stop)
     cd $P4DTG_ROOT/repl
     touch stop-$P4DTG_CFG
     sleep 3
  ;;

  restart)
     $0 stop
     $0 start
  ;;

  status)
     p4dtg_pids=$(get_pids "$P4DTGBIN")
     if [[ -n "$p4dtg_pids" ]]; then
        echo "${P4DTGBIN} is running as pids: $p4dtg_pids."
        exit 0
     else
        echo "${P4DTGBIN} is NOT running."
        exit 1
     fi
  ;;

  *)
       echo "Usage: $0 {start|stop|restart}"
       exit 1
  ;;
esac

exit 0
# Change User Description Committed
#1 19278 trina "Forking branch Main of perforce-software-sdp to trina-sdp."
//guest/perforce_software/sdp/main/Server/Unix/p4/common/etc/init.d/p4dtg_instance_init.template
#3 18961 C. Thomas Tyler Released: SDP/MultiArch/2016.1/18958 (2016/04/08).
#2 15856 C. Thomas Tyler Replaced the big license comment block with a shortened
form referencing the LICENSE file included with the SDP
package, and also by the URL for the license file in
The Workshop.
#1 10148 C. Thomas Tyler Promoted the Perforce Server Deployment Package to The Workshop.