Created
April 10, 2013 08:01
-
-
Save syshack/5352702 to your computer and use it in GitHub Desktop.
sync time every 5 minutes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -e | |
| #Purpose:sync time every 5 minutes | |
| rpm -qi ntpdate >/dev/null 2>&1 | |
| if [ $?!=0 ]; | |
| then yum install ntpdate >/dev/null 2>&1 | |
| if [ $?=0 ]; | |
| path=`whereis -b ntpdate|awk -F": " '{print $2}'` | |
| then echo "*/5 * * * * root $path 10.28.167.2 >/dev/null 2>&1" >>/etc/crontab | |
| echo "Sucess!" | |
| fi | |
| else echo "Failed,Please install *ntpdate* manually" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment