Hacker News new | past | comments | ask | show | jobs | submit login

Open a terminal and then in bash:

    while true; do
        date;
        ./doit.sh;
        sleep 300;
    done | tee doit.log
if you want to get fancy, you can do:

    date "+%Y.%M.%dT%H:%m:%s-%Z`./doit.sh`"
to get it all on one line.



For doing things like this I like using the "watch" command.


Yeah, it is almost at feature parity. The following bloat is not needed at all:

1. Ensure commands are ran after you close the terminal you just opened.

2. Trigger actions when the process did fail (OnFailure=)

3. ensure the scheduling job survives system restarts

4. have proper scheduling, and handling of missed schedule doe to downtime (eg. for notebooks)

5. run the process in cgoups, under other user's context, or in a chroot, etc.

6. apply randomized jitter to the schedule to avoid crating overload and cascading failures resulting from that

7. Timing out tasks

8. Handle service dependencies...

just to name few from the top of my head...

cron is great, and systemd timers are also good, and even more refined solution to the task scheduling problem. Your propsal does not solve even the basics (configurable schedule). As other comment notes your script is more like the watch command.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: