-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscreenshot_functions.sh
executable file
·49 lines (36 loc) · 1.32 KB
/
screenshot_functions.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function MAIN_SCREENSHOT_FUNCTION {
echo "================== SCREENSHOT (tty5) ==========================="
echo
# only run screenshot function if cam found and screenshots are enabled
if [ "$CAM" == "0" ] && [ "$ENABLE_SCREENSHOTS" == "Y" ]; then
echo "Waiting some time until everything else is running ..."
sleep 20
echo "Screenshots enabled - starting screenshot function ..."
screenshot_function
fi
echo "Screenshots not enabled in configfile or we are TX"
sleep 365d
}
function screenshot_function {
while true; do
# pause loop while saving is in progress
pause_while
SCALIVE=`nice /home/pi/wifibroadcast-base/check_alive`
LIMITFREE=3000 # 3 mbyte
# do nothing if no video being received (so we don't take unnecessary screeshots)
if [ "$SCALIVE" == "1" ]; then
# check if tmp disk is full, if yes, do not save screenshot
FREETMPSPACE=`df -P /wbc_tmp/ | awk 'NR==2 {print $4}'`
if [ $FREETMPSPACE -gt $LIMITFREE ]; then
PNG_NAME=/wbc_tmp/screenshot`ls /wbc_tmp/screenshot* | wc -l`.png
echo "Taking screenshot: $PNG_NAME"
ionice -c 3 nice -n 19 /home/pi/wifibroadcast-misc/raspi2png -p $PNG_NAME
else
echo "RAM disk full - no screenshot taken ..."
fi
else
echo "Video not running - no screenshot taken ..."
fi
sleep 5
done
}