Advertisement
Guest User

Date Time Automation

a guest
Jul 4th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.40 KB | None | 0 0
  1. #!/bin/bash
  2. RED='\033[0;31m'
  3. NC='\033[0m' # No Color
  4.  
  5. if [ "$(date | awk '{print $5}')" != "IST" ]
  6. then
  7.     printf "${RED}TIMING IS INCORRECT${NC}, Correcting back to IST\n"
  8.     rm -f /etc/localtime
  9.     ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
  10.     /usr/sbin/ntpdate -u in.pool.ntp.org
  11. else
  12.         printf "${RED}ALL OK${NC}, Date and time is proper\n"
  13.     /usr/sbin/ntpdate -u in.pool.ntp.org
  14. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement