1

This is the content of root's crontab:

0       23      *       *       0-4     /usr/sbin/rtcwake -time `date --date="+16 hours" +"%s"` -m mem

This is set to fire off that command every Sun-Thu at 11pm. The command is essentially a suspend for the next 16 hours while I'm at work to save power. I've test the command with smaller times (30, 60 seconds) and it works. However, when I wake up in the morning and check my machine, it's still running.

Here's what's in the logs:

Jul 24 23:00:01 gallactica CRON[5033]: (root) CMD (/usr/sbin/rtcwake -time `date --date="+16 hours" +")

So does this mean it ran? Why didn't it actually work?

n0pe
  • 9,411
  • 13
  • 60
  • 108
  • That log entry means it ran. Although the log line seems incomplete at the end (copy&paste problem?). If the command produced any output, the user who owns the crontab (root in this case) would have gotten an email – Celada Jul 25 '14 at 10:25
  • I am wondering whether the `%s` in the command has been mangled by `printf` in the log, and maybe in the actual command that was executed too to cause it to fail. – Michael Homer Jul 25 '14 at 10:45
  • @MichaelHomer that makes sense actually. Tonight I'm going to try dumping this line into a separate file instead. I don't think it was a copy paste problem so this seems like the most probably cause. – n0pe Jul 25 '14 at 10:46
  • 2
    See [How can I execute `date` inside of a cron tab job?](http://unix.stackexchange.com/questions/29578/how-can-i-execute-date-inside-of-a-cron-tab-job) – steeldriver Jul 25 '14 at 10:51
  • @steeldriver yup that looks like it may be my issue. I'll give it a try, thanks. – n0pe Jul 25 '14 at 10:53

0 Answers0