[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Which timezone does the cron use in Debian?



On Sun, 22 Mar 2009 17:15:09 -0500
"Boyd Stephen Smith Jr." <bss@iguanasuicide.net> wrote:

> In <[🔎] 20090322151837.7d584022.celejar@gmail.com>, Celejar wrote:
> >On Sun, 22 Mar 2009 13:18:34 +0000
> >Nuno Magalhães <nunomagalhaes@eu.ipp.pt> wrote:
> >> > and the date and time is correct. They're the same as the bios (cmos)
> >> > clock shows.
> >> I'd assume cron uses system-time, so whichever time 'date' tells
> >> you... Did you check to see you don't have any other cron-jobs alying
> >> around?
> >But IIUC, timezone is a property of individual user environments, and
> >is not a systemwide constant;
> 
> It can be overridden by an individual user's settings, but it is also 
> configured system-wide via the /etc/localtime file/symlink.

Thanks; I didn't realize this.
 
...

> >I assume, but I'm no expert, that cron also uses the
> >timezone of the user whose cronjob it's currently running.
> 
> I don't think the user's .bash_profile, .profile, etc. are sourced during a 
> cron run.  Your .bashrc might, but normally not.  Even global files of this 
> type like /etc/profile are generally not sourced during the cron run.
> 
> This means that the user's overrides are generally not honored, so the 
> timezone will be what is specified in /etc/localtime.  The overrides are all 
> via environment variables, so you can set them in your crontab if you want.

Thanks for the explanations.

Celejar
--
mailmin.sourceforge.net - remote access via secure (OpenPGP) email
ssuds.sourceforge.net - A Simple Sudoku Solver and Generator


Reply to: