Quote:
|
Originally Posted by matrixmadhan
use the -u option of date to set,
Code:
date -u <format>
|
Actually, -u ignores your TZ environment variable and causes date to operate in universal time (sort of like the Greenwich mean time). And "format" means something like this:
date "+%Y %m %d"
What we need here is: date MMddhhmmyyyy[.ss]
MM = month
dd = day
hh = hours
mm = minutes
yyyy = 4 digit year
ss = seconds
Yes, the year really is between the minutes and the seconds. As I show the seconds is optional. Actually, so is the year and you can use a 2 digit year. You can add -u to that to specify the time in universal time rather than local time. If you are making a large change in the date, you may want to kill cron first and restart it after the date is changed. If cron notices a date change, it run either run fast or not at all until it "catches up".