---
title: "perforce linux启动脚本"
author: "t0uch"
date: "2009-10-29T15:51:42Z"
tags: ["C", "C#", "C++", "Linux", "脚本"]
slug: "perforce-linux"
draft: false
lastmod: "2009-10-29T15:51:42Z"
id: 506547
url: "https://t0uch.iteye.com/blog/506547"
---

终于把perforce的启动脚本搞定，特此纪念一下。 \[code="java"]#! /bin/sh # # p4d Start the p4d daemon # # Author: Tony Smith # # 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 \[/code]