daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Dec 13th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. # record-ping_cam1.sh
  3. # Check 24h if cam is alive, in case of error code 1 (offline) start record-waitfor_xxx.sh
  4. #
  5. IPCAM=192.168.xxx.xxx
  6. ping -w 86400 -i2 $IPCAM 0>/dev/null
  7. OFFLINE=$?
  8. if [ $OFFLINE -eq 1 ]
  9. then
  10.   source /home/xxx/record-ping-waitfor_cam1.sh
  11. fi
  12.    
  13. #!/bin/sh
  14. # record-ping-waitfor_cam1.sh
  15. # Check if Cam is alive, if yes (exit code 0) then execute record-ping-reconnect_xxx.sh
  16. #
  17. # Ping with infinitive loop - as soon as reachable (exit code 0) then go on with record script
  18. IPCAM=192.168.xxx.xxx
  19. while true; do ping -c1 $IPCAM > /dev/null && break; done
  20. ONLINE=$?
  21. if [ $ONLINE -eq 0 ]
  22. then
  23.   source /home/xxx/record-ping-reconnect_cam1.sh
  24. fi
  25.    
  26. #!/bin/sh
  27. # record-ping-reconnect_cam1.sh
  28. # Record IPcam after any case of signal lost
  29. #
  30. # This will print the current date and time in a format appropriate for storage
  31. STARTTIME=$(/bin/date +"%d.%m.%Y")-"("$(/bin/date +"%H").$(/bin/date +"%M")Uhr")"
  32. #
  33. ## IP Camera Names ##
  34. # Creating date stamps for each of the Cameras
  35. CAM=Cam1_$STARTTIME
  36. #
  37. ## Network and Local Storage Locations  ## #Trailing '/' is necessary here
  38. RCDIR="/home/xxx/Reconnect/"
  39. #
  40. ## Record Time per File sec ##
  41. LENGTH="86400" # (24h)
  42. #
  43. ## Record Settings ##
  44. #
  45. # wait until cam is ready to capture again
  46. sleep 40s
  47. # start capture this camsource
  48. ffmpeg -v 0 -rtsp_transport tcp -i "rtsp://device:port/11" -vcodec copy -an -t $LENGTH $RCDIR$CAM1.mkv & echo $! > /home/xxx/Reconnect/PIDs/ffmpeg_cam1.pid
  49. # start the ping routine, check the cam for connectivity
  50. source /home/xxx/record-ping_cam1.sh & echo $! > /home/xxx/Reconnect/PIDs/ping_cam1.pid
  51. exit
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top