2 ################################################################################
5 # Description: Pings machines listed in machines database and produces a report
6 # about which machines are down
7 # Author: Andrew@DeFaria.com
8 # Created: Thu Oct 5 09:32:21 PDT 2000
11 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
13 ################################################################################
14 # Set me to command name
18 adm_base=${adm_base:-//sonscentral/Corporate/Software/adm}
21 adm_fpath=${adm_fpath:-$adm_base/functions}
27 OS=$(uname -s | sed 's/CYGWIN_//')
29 uname=$(uname -a | tr [:upper:] [:lower:])
32 display "$me [-v|verbose] [-d|debug] [-usage]"
33 display " -v|verbose: Turns on verbose mode"
34 display " -d|debug: Turns on debug mode"
35 display " -usage: Print this usage message"
37 display "The following options will be prompted for if not supplied on the"
38 display "command line. If any parameter has spaces in it then you need to"
39 display "surround it in quotes (e.g. -owners_fullname \"Andrew DeFaria\"."
40 display "You'll probably need to do this for the first 3 in the list below:"
42 display " -owners_fullname Specify owners full name"
43 display " -machine_usage Specify what this machine is to be used for"
44 display " -location Specify where this machine is located"
45 display " -owners_email Specify email address (no @salira.com)"
46 display " -owners_extension Specify phone extenstion"
53 function display_options {
54 display "Setup this machine according to the following profile:"
55 display --------------------------------------------------------------------------------
56 display "Machine Name:\t\t$machine_name"
57 display "Machine Usage:\t\t$machine_usage"
58 display "Machine Location:\t$location"
59 display "Owner's Fullname:\t$owners_fullname"
60 display "Owner's Email:\t\t$owners_email@Salira.com"
61 display "Owner's Extension:\t$owners_extension"
64 function prompt_for_options {
65 # Prompt for options not specified on the command line
66 if [ "_$owners_fullname" = "_" -o "$owners_fullname" = "Unknown" ]; then
67 echo -e "Owner's Fullname"
70 if [ "_$owners_fullname" = "_" ]; then
71 owners_fullname=Unknown
75 if [ "_$machine_usage" = "_" -o "$machine_usage" = "Unknown" ]; then
76 echo -e "What is this machine used for?"
79 if [ "_$machine_usage" = "_" ]; then
84 if [ "_$location" = "_" -o "$location" = "Unknown" ]; then
85 echo -e "Where is this machine located?"
88 if [ "_$location" = "_" ]; then
93 if [ "_$owners_email" = "_" -o "$owners_email" = "Unknown" ]; then
94 echo -e "Owner's Email address:"
95 echo -e "(Should be the same as username. This script will supply the @salira.com)"
98 if [ "_$owners_email" = "_" ]; then
103 if [ "_$owners_extension" = "_" -o "$owners_extension" = "Unknown" ]; then
104 echo -e "Owner's Phone extention:"
105 echo -e "(Should be of the format XXX)"
107 read owners_extension
108 if [ "_$owners_extension" = "_" ]; then
109 owners_extension=Unknown
112 } # prompt_for_options
114 # Set initial parm values
115 owners_fullname=Unknown
117 owners_extension=Unknown
118 machine_usage=Unknown
120 machine_name=$(hostname | tr [:upper:] [:lower:])
123 while [ $# -ge 1 ]; do
138 if [ $# -le 1 ]; then
139 usage "Owner's Full Name is not specified!"
146 if [ $# -le 1 ]; then
147 usage "Machine Usage was not specified!"
154 if [ $# -le 1 ]; then
155 usage "Location was not specified!"
162 if [ $# -le 1 ]; then
163 usage "Owner's Email was not specified!"
170 if [ $# -le 1 ]; then
171 usage "Owner's Extention was not specified!"
174 owners_extension="$1"
178 usage "Unrecognized parameter $1"
185 until [ "$answer" = "done" ]; do
190 display "Correct (Y/n)?\c"
200 owners_fullname=Unknown
202 owners_extension=Unknown
203 machine_usage=Unknown
208 echo "$uname" > /etc/motd
209 cat >> /etc/motd <<:END
210 -------------------------------------------------------------------------------
211 - This is a private system operated for Salira. Authorization from Salira -
212 - management is required to use this system. Use by unauthorized persons is -
213 - prohibited. For system support email: Support@Salira.com -
214 -------------------------------------------------------------------------------
215 Usage: $machine_usage
216 Owner: $owners_fullname <$owners_email@Salira.com>
217 Phone: (408)-325-8700x$owners_extension
219 -------------------------------------------------------------------------------