分页: 1 / 1

仿做了个PTC服务启动脚本

发表于 : 2005-10-09 15:39
gnix_oag
仿做了个PTC服务启动脚本(请指导)

#! /bin/sh
# PTC License Server

. /lib/lsb/init-functions

PATH=/bin:/usr/bin:/sbin:/usr/sbin
START=/usr/local/ptc/flexlm/bin/ptcstartserver
STOP=/usr/local/ptc/flexlm/bin/ptcshutdown

test -x $START || exit 0
test -x $STOP || exit 0

case "$1" in
start)
log_begin_msg "Starting PTC License Server..."
$START
echo $?
;;
stop)
log_beginlog_begin_msg_msg "Stopping PTC License Server..."
$STOP
log_begin_msg $?
;;
force-reload|restart)
sh $0 stop
sh $0 start
;;
*)
log_begin_msg "Usage: ptcserver.d {start|stop|restart|force-reload}"
exit 1
;;
esac

exit 0

发表于 : 2005-10-09 18:05
firehare
应该在脚本中加入下列语句吧?

代码: 全选

. /lib/lsb/init-functions
否则的话,你的 log_begin_msg 函数好象就没有被定义了!
不过我不懂写脚本,只是偶尔会看看脚本!

发表于 : 2005-10-10 10:16
gnix_oag
难怪有错误

发表于 : 2005-10-11 0:16
gnix_oag
. /lib/lsb/init-functions
是什么意思啊

发表于 : 2005-10-11 0:28
leal
导入当前目录下(.)和/lib/lsb/init-functions 目录下的函数?

发表于 : 2005-10-11 0:35
yonsan
应该是调用 /lib/lsb/init-functions吧?
相当于 source /lib/lsb/init-functions ?

发表于 : 2005-10-11 12:26
firehare
yonsan 写了:应该是调用 /lib/lsb/init-functions吧?
相当于 source /lib/lsb/init-functions ?
正解!
是source的一种简单写法!相当于C中的include