Skip to content

Instantly share code, notes, and snippets.

@ZigFisher
Last active November 3, 2018 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZigFisher/d58a165068248bc9c6689a6a98c6ab4a to your computer and use it in GitHub Desktop.
Save ZigFisher/d58a165068248bc9c6689a6a98c6ab4a to your computer and use it in GitHub Desktop.
#!/bin/sh
server="ipcam.octonix.net"
login="mylogin"
password="mypass"
devid="$(ifconfig eth0 | awk '/HWaddr/ {print $5}' | tr -d ':')"
snapshot="http://127.0.0.1/webcapture.jpg?command=snap&channel=1"
upload="http://${server}/~${login}/${devid}/$(TZ=':GMT-3' date +%Y/%m/%d/%H.%M'.jpg')"
timeout="12"
tmp="/var/tmp"
/bin/rdate -s time.nist.gov >/dev/null 2>&1
echo ${upload} >/dev/null 2>&1
curl -k -s --connect-timeout ${timeout} --max-time ${timeout} -o ${tmp}/snap.jpg "${snapshot}" >/dev/null 2>&1
curl -k -s --connect-timeout ${timeout} --max-time ${timeout} -u "${login}:${password}" -T ${tmp}/snap.jpg "${upload}" >/dev/null 2>&1
rm -f ${tmp}/snap.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment