- #!/bin/bash
- # Use chkconfig --add psm to set up the script to start and stop automatically.
- # P4Search Init Script.
- # chkconfig: 345 91 29
- # description: Start P4Search Monitor for instance REPL_SDP_INSTANCE.
- # Load SDP controlled shell environment.
- source /p4/common/bin/p4_vars REPL_SDP_INSTANCE ||\
- { echo -e "\nError: Failed to load SDP environment for instance REPL_SDP_INSTANCE.\n"; exit 1; }
- source $P4CBIN/ps_functions.sh ||\
- { echo -e "\nError: Failed to load SDP ps_functions.sh lib.\n"; exit 1; }
- if [[ $(id -u) -eq 0 ]]; then
- exec su - $OSUSER -c "$0 $*"
- elif [[ $(id -u -n) != $OSUSER ]]; then
- echo "$0 can only be run by root or $OSUSER"
- exit 1
- fi
- export PSM_ROOT=${P4HOME}}/psm/
- export RACK_ENV=production
- export THISSCRIPT=${0##*/}
- pid=0
- GetPID() {
- pid=`ps ax | grep ruby | grep psm | grep -v grep | awk '{print $1;}'`
- }
- Status() {
- GetPID
- if [ "q$pid" = q ] ; then
- echo "psm is stopped"
- else
- echo "psm ($pid) is running"
- fi
- exit 0
- }
- Start() {
- psm &
- exit $?
- }
- Stop() {
- GetPID
- kill $pid
- exit $?
- }
- Usage() {
- echo -e "\nUsage: $THISSCRIPT {start|stop|status|restart}\n"
- exit 100
- }
- if [ $# != 1 ] ; then
- Usage
- fi
- case ${1:-status} in
- reload)
- GetPID
- kill -HUP $pid
- opid=$pid
- GetPID
- if [ "q$pid" != q -a $pid = $opid ] ; then
- echo "psm reloaded"
- else
- echo "psm not running"
- fi
- ;;
- restart)
- Stop
- Start
- ;;
- start)
- Start
- ;;
- status)
- Status
- ;;
- stop)
- Stop
- ;;
- *)
- Usage
- ;;
- esac
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 23314 | matt_peterson | integrate sdp version 23041 | 7 years ago | |
//guest/perforce_software/sdp/main/Server/Unix/p4/common/etc/init.d/psm_init.template | |||||
#4 | 20519 | C. Thomas Tyler | Released SDP 2016.1.20491 (2016/09/09). Copy Up using 'p4 copy -r -b perforce_software-sd...p-dev', with selective removal of work-in-progress files. « |
9 years ago | |
#3 | 20481 | C. Thomas Tyler | Released SDP 2016.1.20460. Copy Up using 'p4 copy -r... -b perforce_software-sdp-dev', with selective removal of changes related to work-in-progress files. « |
9 years ago | |
#2 | 20353 | C. Thomas Tyler | Released SDP 2016.1.20348. Copy Up using 'p4 copy -r -b perforce_software-sdp-dev', with... selective removal of changes related to work-in-progress changes. « |
9 years ago | |
#1 | 15582 | Russell C. Jackson (Rusty) | Init script that works with the psm module from Insights as opposed to the example one &...nbsp;that calls commands that do not exist. « |
10 years ago |