Advertisement
Ploink

Untitled

Aug 27th, 2019
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.61 KB | None | 0 0
  1. #!/bin/bash
  2. export LC_ALL=en_US.UTF-8
  3. FILE="/mnt/data/temp/timelog.csv"
  4. CMD="curl -s -m 60 --output /dev/null https://f-droid.org/assets/favicon-16x16.png --resolve f-droid.org:443:5.9.48.82"
  5.  
  6. HDR=$(cat << HDR
  7. "# ${CMD}"
  8. "# Timestamp is MsExcel compatible, just format cell as date/time"
  9. "Timestamp","Time(s)","Error"
  10. HDR
  11. )
  12.  
  13. echo "$HDR" > "${FILE}"
  14. TIMEFORMAT=%R
  15. while sleep 60
  16. do
  17.     # Exit script when FILE is deleted, moved or renamed.
  18.     [ -e "${FILE}" ] || break
  19.     D=$(echo "($(date +%s%z*36)) / 86400 + 25569 " | bc -l)
  20.     T=$( (time ${CMD}|tail -n1) 2>&1 )
  21.     echo "$D,$T,$?" >> $FILE
  22. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement