"Default" way to change timezone?
-
Hey, guys. Happy holidays!
So I installed a basic LAMP app in order to run a few small jobs and services I have for personal use.
I use the scheduler for the jobs, but my server is not in my timezone, and I understand it's cloudron's policy to have everything outside applications in GMT, which makes sense. But that leads to me having to schedule stuff with GMT in mind, which is not ideal.
Is there a way to set timezone for a specific app container, or is that done on an app-by-app basis? I'd like to not have to package and publish a cloudron app just for that, but am failing to see how easily do this.
Is there a "default" way of injecting environment variables? Does cloudron's base image support some set of env vars it loads from somewhere?
Thanks!
-
Unless I'm missing something you just change your timezone setting as described here https://docs.cloudron.io/settings/#system-time-zone no?
-
The host machine and servers generally are best to be run in UTC since they possibly serve users in various timezones. The apps itself, like the Cloudron dashboard and such should then translate from UTC to the local timezone (and locale formats) based on the user setting or browser profiles.
-
Yeah, I understand and that makes sense. Scheduled jobs are the only case in which this is kind of annoying, right? Since the container should still run in UTC, but then we should account for it when scheduling our jobs.
Maybe I'll just find another way to schedule the jobs, since a few of them need to be run in a specific time of day (on my TZ). I guess this would be the preferred approach? Because even if I account for the difference in hours and schedule them in UTC time, there's all kinds of specifics like daylight savings and the like that would make it kind of a nightmare...
Thanks anyway for the answers
-
Thanks for your help, @nebulon, but it seems that's not how it works. At least not on my cloudron.
I'm using a LAMP app, and the "Cron" item on its config page.This is how it looks:
# +------------------------ minute (0 - 59) # | +------------------- hour (0 - 23) # | | +-------------- day of month (1 - 31) # | | | +--------- month (1 - 12) # | | | | +---- day of week (0 - 6) (Sunday=0 or 7) # | | | | | # * * * * * command to be executed # * 7,8 * * 1-5 /app/data/latest/main.sh >> /app/data/app.log
It should fire at 7am and then again at 8am, on weekdays. And it's working, but it's 7 and 8am UTC, not on my timezone. And I've changed cloudron's system timezone to my local time.
-
You are right, just checked the code at https://git.cloudron.io/platform/box/-/blob/master/src/scheduler.js?ref_type=heads#L84 which sets up the cron job for the app. That does not specify the timezone, so it runs in UTC. In fact even our docs at https://docs.cloudron.io/apps/#cron mention this aspect correctly.
I confused the usage here myself, where the timezone only affects selected cron jobs like autoupdate and backups