红联Linux门户
Linux帮助

一个关于SH脚本的问题

发布时间:2011-03-06 14:52:22来源:红联作者:kob521
#!/bin/sh
CAM="CCcam_2.1.4"
OSD="CCcam 2.1.4"
PID=`pidof $CAM`
Action=$1

cam_clean () {
rm -rf /tmp/mg* /tmp/cccamd.info /tmp/msg.info /tmp/ucm_cam.info /tmp/ecm.info /tmp/pid.info /tmp/cardinfo /tmp/cam.info /tmp/debug.txt /tmp/ecm0.info /tmp/share.info /tmp/share.onl /tmp/stat.info
}

cam_handle () {
if test -z "${PID}" ; then
cam_up;
else
cam_down;
fi;
}

cam_down () {
killall $CAM
sleep 2
cam_clean
}

cam_up () {
/usr/bin/$CAM &
}

if test "$Action" = "cam_res" ; then
cam_down
cam_up
elif test "$Action" = "cam_down" ; then
cam_down
elif test "$Action" = "cam_up" ; then
cam_up
else
cam_handle
fi

exit 0

注意这段
cam_up () {
/usr/bin/$CAM &
}
假如我想在运行cam程序之前运行另一程序pmttrans的话,该如何写进脚本,pmttrans在/user/bin/pmttrans目录下
文章评论

共有 4 条评论

  1. cjzhang 于 2011-03-06 21:36:12发表:

    学习,学习

  2. 2005wind 于 2011-03-06 21:25:13发表:

    sh /user/bin/pmttrans ?

  3. tiany524 于 2011-03-06 18:43:53发表:

    不清楚呢
    可否详细点

  4. langhun 于 2011-03-06 17:58:31发表:

    没看懂