perforce linux启动脚本

终于把perforce的启动脚本搞定,特此纪念一下。

#! /bin/sh
#
# p4d           Start the p4d daemon
#
# Author:       Tony Smith <tony at perforce.com>
#
# chkconfig: 345 85 05
# description: Starts the Perforce server process
#
# processname: p4d
# daemon  - makes rc startup work properly
# killproc - makes rc shutdown work properly

# Source function library.
#. /etc/init.d/functions

P4ROOT="/opt/perforce_db/db"
P4PORT=1666
P4LOG="/opt/perforce_db/log/err"
P4AUDIT="/opt/perforce_db/log/audit"

RETVAL=0

# See how we were called.
case "$1" in
  "start")
        echo -n "Starting Perforce server: "
        su p4_user -c "/usr/local/bin/p4d -r $P4ROOT -A $P4AUDIT -L $P4LOG -p $P4PORT -d"
        echo
        touch /var/lock/subsys/p4d
        ;;
  "stop")
        echo -n "Stopping Perforce server: "
        su - root -c "/usr/local/bin/p4 admin stop"
        #killproc p4d
        rm /var/lock/subsys/p4d
        echo
        ;;
  "status")
        #status p4d
        RETVAL=$?
        ;;
  "restart")
        $0 stop
        $0 start
        RETVAL=$?
        ;;
  *)
        echo "Usage: p4d {start|stop|status|restart}"
        exit 1
esac

你可能感兴趣的:(C++,c,linux,脚本,C#)