Scenario: You have a user with no access to cron and need to schedule a job (say an rsync of a directory). The use of at is not an option as you don't have a fixed end date.

While I bet there are thousands of ways to accomplish this here's mine:

  • normally user has always access to corn - his own cron but obviously not root's – Drako Apr 20 '18 at 11:58
  • and another question - why is user taken away user cron access? give it back. – Drako Apr 20 '18 at 12:01
  • as well - if its rsync - then rsync can be configured as deamon – Drako Apr 20 '18 at 12:02

Quick and dirty:

Open a screen session and create a while loop like that:

while : ; do
echo "$(date : Hey, I'm running this nice stuffz)"
time do_stuff
sleep 1d

The key here is the sleep command: It accepts much more than just a value in miliseconds. There are format specifiers for second (s), minute(m), hour(h) and day(d). Even more, GNU sleep is not only able to handle integers as values but it can actually handle arbitrary floats (info '(coreutils) sleep invocation'). This means that you could write stuff like:

sleep 0.33d  or  sleep 0.5h

The latter is pretty much useless, but so you know ;)

|improve this answer|||||
  • interesting solution though :D – Drako Apr 20 '18 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.