Initial add of defaria.com
[clearscm.git] / defaria.com / Computers / code / adm / bin / fixntp
1 #!/bin/bash
2 ################################################################################
3 #
4 # File:         fixntp
5 # Description:  This script will fix /etc/rc.config.d/netdaemons to set 
6 #               NTPDATE_SERVER to cupertino.ntp.hp.com
7 # Author:       Andrew DeFaria (defaria@cup.hp.com)
8 # Language:     Korn Shell
9 # Modified:
10 #
11 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
12 #
13 ################################################################################
14 # First source /app/appserver
15 if [ -x /app/appserver ]; then
16   . /app/appserver
17 fi
18
19 if [ $(id -u) -ne 0 ]; then
20   print -u2 "Error: You must be root to execute this command!"
21   exit 1
22 fi
23
24 if [ "$OS" = "09" ]; then
25   print -u2 "Error: $(basename $0) does not run on 9.x!"
26   exit 1
27 fi
28
29 netdaemons=/etc/rc.config.d/netdaemons
30 netdaemons_new=/etc/rc.config.d/netdaemons.$$
31
32 sed 's/NTPDATE_SERVER=$/NTPDATE_SERVER=cupertino.ntp.hp.com/' \
33   $netdaemons > $netdaemons_new
34
35 if cmp -s $netdaemons $netdaemons_new; then
36   rm -f $netdaemons_new
37   print "NTPDATE_SERVER already set properly - No fix needed!"
38 else
39   mv $netdaemons_new $netdaemons
40   chmod 555 $netdaemons
41   chown bin:bin $netdaemons
42   print "Changed NTPDATE_SERVER to be set properly"
43 fi