Initial add of defaria.com
[clearscm.git] / defaria.com / Computers / code / adm / bin / restart_system
1 #!/bin/bash
2 ################################################################################
3 #
4 # File:         restart_system
5 # Description:  A script to restart a system. Used for at jobs mainly.
6 # Author:       Andrew@DeFaria.com
7 # Created:      Wed Apr 16 14:14:17 PDT 1997
8 # Modified:
9 # Language:     Korn Shell
10 #
11 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
12 #
13 ################################################################################
14 # Set me to command name
15 me=$(basename $0)
16
17 # Set adm_base
18 adm_base=${adm_base:-//sonscentral/Corporate/Software/adm}
19
20 # Set adm_fpath
21 adm_fpath=${adm_fpath:-$adm_base/functions}
22
23 # Source functions
24 . $adm_fpath/common
25
26 # Who do notify about the restart
27 notify=${notify:-$LOGNAME}
28
29 if is_not_root; then
30   error "This script must be run as root" 1
31 fi
32
33 message="Restarting $(hostname) ($(uname -s)) via $me"
34 info $message
35 #mailx -s "$message" $notify <<!EOF
36 #$message
37 #!EOF
38
39 cd /
40
41 if [ $(uname -s) = "HP-UX" ]; then
42   /etc/shutdown -yr 0
43 else
44   /etc/shutdown -yg 0 -i 6
45 fi