register-machine 565 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/bin/zsh -f

PROG="${0##*/}"
case "$PROG" in
  register-*|ohcreg) FOO=register ;;
  *) FOO="${PROG%%-*}" ;;
esac

LOG=/home/fare/off-hours-computations/incoming/log

DATE="$(date -u +"%Y-%m-%d.%H:%M:%S")"
IPADDRS="$(/sbin/ifconfig | grep "inet addr" | grep -v 127.0.0.1 | \
	   perl -npe 's/^.*addr:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+) .*$/$1/')"

ENTRY="$(echo $FOO $USERNAME $HOST $DATE $IPADDRS ${1+# $*})"

echo "$ENTRY" >> $LOG

echo "The following entry has been logged:"
echo "$ENTRY"
echo
echo "Thank you for participating in the off-hours computation farm."