-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslideshow.sh
More file actions
65 lines (60 loc) · 884 Bytes
/
slideshow.sh
File metadata and controls
65 lines (60 loc) · 884 Bytes
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
FOLDER="/home/pi/img/"
TEMPF="/tmp/slideshow";
export DISPLAY=":0"
if [ -d $FOLDER ]
then
MD5C=$(ls -al $FOLDER | md5sum | awk '{ print $1 }');
else
echo "Error: Folder does not exist";
fi;
case $1 in
start)
feh --quiet -Z -F -Y --slideshow-delay 12 $FOLDER &
echo $MD5C > $TEMPF
;;
stop)
pgrep -f "feh" > /dev/null && kill `pgrep -f "feh"` && rm $TEMPF
;;
restart)
$0 stop && $0 start
;;
status)
if [ $(pgrep -f "feh") ]
then
echo "Slideshow running";
exit 0;
else
echo "Slideshow not running";
exit $?
fi
;;
cron)
if [ -e $TEMPF ]
then
MD5O=$(cat $TEMPF)
if [ $(pgrep -f "feh") ]
then
# Passt
true
else
$0 start;
fi
else
echo "Slide show not started or $TEMPF vanished"
exit 0
fi
# Changes made = restart
if [[ $MD5O != $MD5C ]]
then
echo $MD5C > $TEMPF
$0 stop
$0 start
exit 0
fi
;;
*)
echo "Usage: $0 {start|stop|reload|cron}";
exit 2
;;
esac