- 论坛徽章:
- 4
|
一个监控进程的脚本
#!/bin/bash
echo `ps aux|awk '/SearchIndexer[.]jar/{printf $2}' > /usr/local/yewubao/oo.txt
cd /usr/local/yewubao
if [ -s oo.txt ];
then
nohup java -jar /usr/local/yewubao/SearchIndexer.jar &
sleep 2
exit
else
kill -9 `ps aux|awk '/SearchIndexer[.]jar/{printf $2}' `
nohup java -jar /usr/local/yewubao/SearchIndexer.jar &
sleep 2
fi
exit
执行的时候报:./test.sh: line 10: unexpected EOF while looking for matching ``'
./test.sh: line 15: syntax error: unexpected end of file
但是我执行kill -9 `ps aux|awk '/SearchIndexer[.]jar/{printf $2}' `,是能正常执行的 |
|