Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # ./loghost.sh
- # Israel Torres 20121025 host site logger - pings host and logs when it came back up
- ltimestamp=$(date +%s)
- ltsreadable=$(date -r $ltimestamp)
- HOST=$1
- echo "Scanning:: $HOST as of [$ltimestamp] $ltsreadable ..."
- ping -o $HOST > /dev/null
- if [ "$?" = 0 ]; then
- timestamp=$(date +%s)
- tsreadable=$(date -r $timestamp)
- echo "$HOST appears UP as of [$timestamp] $tsreadable ***" | tee "log-$timestamp-$HOST.txt"
- else
- echo "weird error"
- fi
- #eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement