Sunday, April 15, 2012

Scheduling with CronTab

  • Run as root

crontab –e

  • Usage

# m h  dom mon dow   command

For example, schedule a reboot at 8pm(system time) on every sunday

00 20 * * 7 shutdown -r now

Time sync with NTP

 

  • Install NTP

apt-get install ntp

  • Update server list

vi /etc/ntp.conf

Example -

server 0.us.pool.ntp.org iburst
server 1.ca.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst

  • Restart NTP

/etc/init.d/ntp restart

  • Monitor

ntpq -p

Setting server timezone on Debian

 

The interactive way

dpkg-reconfigure tzdata

The manual way

  1. echo 'Etc/UTC' > /etc/timezone or echo 'Asia/HongKong' > /etc/timezone
  2. dpkg-reconfigure --frontend noninteractive tzdata