debianmacno-cupsnodebathenaweb
Last change
on this file since c7b9feb was
c7b9feb,
checked in by Jessica B. Hamrick <jhamrick@…>, 16 years ago
|
Initial commit
|
-
Property mode set to
100644
|
File size:
1.0 KB
|
Rev | Line | |
---|
[c7b9feb] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | PATH=/sbin:/bin:/usr/sbin:/usr/bin |
---|
| 4 | |
---|
| 5 | # We want a unique ID for each machine, ideally surviving a reinstall. |
---|
| 6 | # Produce the ID using the hardware addresses of the ethernet devices, |
---|
| 7 | # and save it to a file so that it at least survives the duration of |
---|
| 8 | # this install. |
---|
| 9 | idfile=/var/lib/debathena-counterlog/id |
---|
| 10 | if [ -r $idfile ]; then |
---|
| 11 | id=$(cat $idfile) |
---|
| 12 | else |
---|
| 13 | id=$(ifconfig -a | sed -nre 's/.*HWaddr ([^ ]+).*/\1/p' | sort -u \ |
---|
| 14 | | md5sum | awk '{print $1}') |
---|
| 15 | echo "$id" > $idfile |
---|
| 16 | fi |
---|
| 17 | |
---|
| 18 | version=$(machtype -L) |
---|
| 19 | loghost=wslogger.mit.edu |
---|
| 20 | host=$(hostname --fqdn) |
---|
| 21 | mtype=$(machtype) |
---|
| 22 | ctype=$(machtype -c) |
---|
| 23 | |
---|
| 24 | # Traditionally, we do counter logging via syslog. (We could do it |
---|
| 25 | # via HTTP post or something else instead, if we wanted.) We can't |
---|
| 26 | # rely on central syslogging being configured because that's a |
---|
| 27 | # cluster-only package. Fortunately, the syslog protocol is dead |
---|
| 28 | # simple, so just fake a packet to the log host. |
---|
| 29 | msg="<13>root: counterlog: $host $mtype $ctype $version $id cron" |
---|
| 30 | printf "%s" "$msg" | nc -q0 -u $loghost syslog |
---|
Note: See
TracBrowser
for help on using the repository browser.