As we all know, the current linux run Task Scheduler we generally plan to achieve by means of crontab task. But this task default minimum plan in minutes, that is the smallest unit of one minute once, that if we need to be performed in units of seconds, it can not directly implement. |
Before we come into contact with sleep and script running in the background, then this can come in handy, and ideas:
1, write a shell , throwing running in the background;
2, shell write an infinite loop, perform the required command , sleep interval in seconds. In this way, you can achieve as a unit performed in seconds.
For example, every one second interval print time /tmp/date.txt output to a file, date.sh script as follows:
#!/bin/bash while :; do echo `date` >> /tmp/date.txt sleep 1 done
The script thrown into the background:
nohup /home/shell/date.sh &
Of course, you can also create a virtual terminal screen by means of execution, this tool personally like.
This article addresses: https://www.linuxprobe.com/linux-shell-crontab.html