加入两个linux脚本

时间:2016-07-01 06:24:53

标签: linux

我有一个朋友需要在linux中加入两个脚本,我不知道怎么做。有人可以帮帮我们吗?脚本在

下面
#!/bin/sh

if ps x |grep -v grep |grep -c oscam     >/dev/null
then
echo "oscam... ok"
else
echo "oscam... restarting"
/var/bin/oscam &
fi


#!/bin/sh

echo "Stop oscam"
killall -9 oscam 2>/dev/null
  sleep 2
 echo "Start oscam"
 /var/bin/oscam &

exit 0

1 个答案:

答案 0 :(得分:-1)

删除第二次出现"#!/ bin / sh"。您的组合脚本将如下所示

#!/bin/sh

if ps x |grep -v grep |grep -c oscam     >/dev/null
then
echo "oscam... ok"
else
echo "oscam... restarting"
/var/bin/oscam &
fi

echo "Stop oscam"
killall -9 oscam 2>/dev/null
  sleep 2
 echo "Start oscam"
 /var/bin/oscam &
exit 0