内容简介:有时候我们需要每秒执行一次命令,通过linux自带的cron却不能实现,新版的cron据说可以精确到秒。很简单的,通过下面的方法,你也能每秒执行一次自己想要的任务了
有时候我们需要每秒执行一次命令,通过linux自带的cron却不能实现,新版的cron据说可以精确到秒。
很简单的,通过下面的方法,你也能每秒执行一次自己想要的任务了:)
1.编写shell脚本
mkdir /root/bin
vi /root/bin/gaojinbo.sh
#!/bin/sh
while [ true ]; do
/bin/sleep 1
/bin/date >>/tmp/date.txt
done
2.后台运行
nohup /root/bin/gaojinbo.sh &
3.确认每秒执行
tail -f /tmp/date.txt
完成!
k@ygsi:/cus$ while true ; do sleep 1 ; du mozilla-central/ --max-depth=1; du -h mozilla-central/ --max-depth=1;echo $'\t'; done
k@ygsi:/cus$ while true ; do sleep 1 ; du mozilla-central/ --max-depth=1; du -h mozilla-central/ --max-depth=1;echo $'\t\n'; done
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
How Great Decisions Get Made
Maruska, Don / 2006-2 / $ 20.28
All too often, solving tough work issues can become a tug of war as clashing departments, priorities, personality styles, and other concerns threaten to destroy any possibility of a successful conclus......一起来看看 《How Great Decisions Get Made》 这本书的介绍吧!
Markdown 在线编辑器
Markdown 在线编辑器
HSV CMYK 转换工具
HSV CMYK互换工具