1

When I run crontab -e, I see this bit:

Notice that tasks will be started based on the cron's system daemon's notion of time and timezones.

How to convert the cron's system daemon's notion of time and timezones to something I understand or is there some way I can work it out?

I don't keep my machine on all the time and so I would like to set a daily time when my machine is most likely to be on.

0
  • You can add

    * * * * * date > /tmp/current_time.txt
    

    and see what time cron is running with. Cron will use local time so it should (by default) show UTC.

  • See /etc/default/cron if you want to change it. It will show TZ=UTC (by default).

  • Okay, you're suggesting I run the date command but why * * * * *? Please explain! This will be my first cron attempt. – Justice for Monica Mar 12 '14 at 12:48
  • I did that and got Wed Mar 12 18:21:01 IST 2014 which is my local time. So, if I want to run a job everyday at 17:00:00 what should I use? – Justice for Monica Mar 12 '14 at 12:52
0

Problem: the introductory comments one sees when running crontab -e include these words:

Notice that tasks will be started based on the cron's system daemon's notion of time and timezones.

What that actually means is not clear to me that is why I asked the question.

So I ran crontab -e to have this line:

45 16 * * * touch /home/dbk/Desktop/$(date +\%H:\%M:\%S).txt

What I'm asking cron to do is to create a file with the current time as prefix and .txt as extension and to do this at 16:45 h based on the cron's system daemon's notion of time and timezones.

Whenever the file is created, I can compare the prefix of the file with the "date modified" and thereby come to know what time cron ran the job.

As it so happens, cron ran the job at 16:45 IST which is my local time.

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.