2015-10-16

[SOLVED]Linux schedule 1s

#11:53 13/07/2015
#################
#crontab -e
#1min:
* * * * * /opt/script/schedule-per-1s.sh



root@drbd1:/opt/script# cat /opt/script/schedule-per-1s.sh
#!/bin/bash
#http://serverfault.com/questions/246044/how-can-i-schedule-a-cron-job-that-runs-every-10-seconds-in-linux
#
i=0
while [ $i -lt 60 ]; do
  /opt/script/get-date-1s.sh &
  sleep 1
  i=$(( i + 1 ))
done

root@drbd1:/opt/script#




root@drbd1:/opt/script# cat /opt/script/get-date-1s.sh
echo "$(date)">>/mnt/storage/date.log
root@drbd1:/opt/script#

No comments:

Post a Comment