1:后台运行脚本
只要在命令后加个$符就行
commands &
2:计划定时执行脚本
cron时间表
min hour dayofmonth month dayofweek command
构建cron时间表
crontab -e
cron目录
anacron程序
当用bash启动一个程序,你可以用在程序后加&,实现程序在后台运行;
例如: watch df -i &
但如果你忘了输入&;但你又不想把程序停止后重新启动;
你可以这么做:
按Ctrl + Z暂停前台工作,比如前面提到的watch df -i;
然后用jobs命令查看当前bash一共启动了多少程序,你可以看到你的watch df -i在其中,它的状态是Stoped的; 并且它的jobID也可以看,比如是1
然后用命令bg 1
这样你就可以达到和watch df -i &一样的效果了。
如果需要把任务回到前台,只需要fg 1.
转载于:https://blog.51cto.com/stephenzhao/538739
1. nohup(这里只记录这一个,其他也有,但这个够用了)
nohup python *.py > china_fund.file 2>&1 & nohup:忽略挂起信号 &: 后台运行 查看方式:jobs -l
二.以后台模式运行脚本
1:后台运行脚本
只要在命令后加个$符就行
commands &
2:计划定时执行脚本
cron时间表
min hour dayofmonth month dayofweek command
构建cron时间表
crontab -e
cron目录
anacron程序转载于:https://my.oschina.net/yulongjiang/blog/184540
http://blog.csdn.net/CAIYUNFREEDOM/article/details/6339390
http://blog.sina.com.cn/s/blog_605f5b4f0100x28u.html