检查进程的状态并启动另一个脚本,然后在unix中完成

时间:2017-08-15 08:31:09

标签: linux shell unix

我正在编写一个脚本,它将检查正在运行的作业的当前状态,一旦完成它将在shell脚本中启动另一个脚本。需要对此有所了解。

#!/bin/ksh

#checking the current status of the job:
ps -ef |grep /spaet1b/work/scripts/loading.ksh
if [$? -eq 0 ];
then
cd /home/ashish/
./trigger_su.ksh
exit 0
fi

请纠正我。

1 个答案:

答案 0 :(得分:0)

尝试使用pgrep -f

pgrep -f loading.ksh
if [$? -eq 0 ];
then
cd /home/ashish/
./trigger_su.ksh
exit 0
fi