下面这行命令放终端执行没啥问题,但是放到 shell 脚本中,就报错了,导致脚本执行不下去了
liuxindeMacBook-Pro:jindouyun_service phperstar$ ps aux |grep Stock |grep -v 'grep' |grep -v 'serviceRolad.sh' | awk '{print $2}' | xargs kill -9
liuxindeMacBook-Pro:jindouyun_service phperstar$
liuxindeMacBook-Pro:jindouyun_service phperstar$
liuxindeMacBook-Pro:jindouyun_service phperstar$ ./serviceReload.sh Stock
Stock
Killed: 9
liuxindeMacBook-Pro:jindouyun_service phperstar$ cat ./serviceReload.sh
#!/bin/bash
echo $1
ps aux |grep $1 |grep -v 'grep' |grep -v 'serviceRolad.sh' | awk '{print $2}' | xargs kill -9
echo $2
php start.php --service=$1 --daemonize=$2
liuxindeMacBook-Pro:jindouyun_service phperstar$
1
x1314aq 2019-09-22 10:39:37 +08:00 via iPhone
如果你用的 bash 的话,在脚本最前面加入
set -x 再跑一下,就可以看到出错的地方了 |