Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 进程未从cron下的脚本运行_Linux_Bash_Cron - Fatal编程技术网

Linux 进程未从cron下的脚本运行

Linux 进程未从cron下的脚本运行,linux,bash,cron,Linux,Bash,Cron,我的cron计划是: * * * * * /home/sa-mp/samp03/fix.sh 我的剧本是: #!/bin/bash if ! pgrep samp03svr; then /home/sa-mp/samp03/samp03svr & echo "$(date): Process start" >> /home/sa-mp/samp03/restart_log.txt fi 在手动调用脚本时,它可以正常工作,但当cron调用该脚本时,进程“sam

我的cron计划是:

* * * * *    /home/sa-mp/samp03/fix.sh
我的剧本是:

#!/bin/bash
if ! pgrep samp03svr; then
  /home/sa-mp/samp03/samp03svr &
  echo "$(date): Process start" >> /home/sa-mp/samp03/restart_log.txt
fi
在手动调用脚本时,它可以正常工作,但当cron调用该脚本时,进程“samp03svr”不会运行

脚本和进程的权限为755

var/log/cron.log中的行:

/USR/SBIN/CRON[3662]: (root) CMD (/home/sa-mp/samp03/fix.sh)
试着这样做:

* * * * *    /home/sa-mp/samp03/fix.sh >  /home/sa-mp/samp03/fix.sh.out

请告诉我们什么是samp03svr。

这只会创建一个空的fix.sh.out文件。samp03svr是游戏服务器。