rudimentary java library beginning. cleaned up scripts quite
[feisty_meow.git] / scripts / users / byejob.sh
1 #!/bin/bash
2
3 # this program is run in the background to show a bye message on the console.
4
5 export LIGHTWEIGHT_INIT=true  # make sure we just get our variables.
6 source $HOME/yeti/scripts/launch_feisty_meow.sh
7 export host=$(hostname)
8
9 # use this to always print the message.
10 #  export hostlist=$host
11
12 # only print on a few...
13 export hostlist='chandra ducky equanimity gulliver hamstergate \
14   mycroft mrowrt numenor shaggy simmy slowboat velma wolfe \
15 \
16   dervish frylock lagomorph shakezula '
17 #hmmm: this hostlist is highly dependent on my own favorite host names.
18 # to commoditize this, we should instead use a config file for the list.
19
20 # set our domain name based on what's found in the resolv.conf file, where
21 # dns info is often found.
22 DOMAIN_NAME=$(grep -i search </etc/resolv.conf | tail -1 | sed -n -e 's/domain.\(.*\)$/\1/p')
23 if [ -z "$DOMAIN_NAME" ]; then
24   # second try, searching out the search domain as a suitable replacement
25   # for the actual domain being specified.
26   DOMAIN_NAME=$(grep -i search </etc/resolv.conf | tail -1 | sed -n -e 's/search.\(.*\)$/\1/p')
27 fi
28 # oh well, we don't know what the heck the domain is.
29 if [ -z "$DOMAIN_NAME" ]; then DOMAIN_NAME=unknown_domain; fi
30
31 echo domain is $DOMAIN_NAME
32
33 for i in $hostlist; do
34   if [ "$host" = "$i" -o "$host" = "$i.$DOMAIN_NAME" ]; then
35 #    echo $(date_stringer)": $host matched." >>$HOME/host_matched_in_byejob.txt
36     ( /bin/bash <<end
37       sleep 7; bash $FEISTY_MEOW_SCRIPTS/users/byemessage.sh /dev/console
38 end
39     )&
40 jobs
41   fi
42 done
43