目的:Linux后台执行脚本并监控
- 编写shell脚本
vi /tmp/ceshi.sh
#!/bin/sh
while [ true ]; do
srync -avzP src dest
/bin/sleep 1
/bin/date >>/tmp/date.txt
done
- 后台运行
nohup /tmp/ceshi.sh 2>&1 > /dev/null &
- 查看执行
tail -f /tmp/date.txt
- 停止脚本运行进程
ps -ef | grep ceshi.sh |kill -9
1787

被折叠的 条评论
为什么被折叠?



