简体   繁体   中英

Run servers in one machine in different timezone

I am running Three Quartz servers (as java wrapper services) from one Linux Virtual Server machine. My requirement is to run these servers in different time zone in one machine. eg Say there are three servers name A, B and C then A should schedule job based on Central Time zone , B should schedule jobs based on Eastern Time zone and so on. Is there any way we could achieve this?

Time zones are but concepts in Unix land. Each system clock should run with UTC, calculating displayed times based on the timezone you configure within the system.

Depending on which software should deal with that, it might be totally sufficient to set the TZ environment variable correctly.

I created three users for three different servers and set the desired time zones in .bashrc file. Say user name is user1 then do the following:

  1. Open file /home/user1/.bashrc usinf any editor.
  2. Modify and enter this line:

    export TZ="/usr/share/zoneinfo/{TIMEZONE-DIRECTORY}/{TIMEZONE_FILE}"

  3. Save the file.

Timezone is set for the user now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM