-
Notifications
You must be signed in to change notification settings - Fork 0
/
wall
executable file
·67 lines (59 loc) · 1.38 KB
/
wall
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
66
67
#!/bin/bash
CURRENT_DIR=$(pwd)
DIR=$(dirname $0)
if [ $DIR == '.' ]; then
DIR="$CURRENT_DIR"
fi
init(){
if [[ "$OSTYPE" == "darwin"* ]]; then
cat /dev/null > "${DIR}/log"
return;
elif [["$OSTYPE" == "linux-gnu"]]; then
echo "Linux"; exit 1;
elif[["$OSTYPE" == "cygwin"]]l then
echo "cygwin : linux emulator for win"
exit 1;
elif [[ "$OSTYPE" == "msys" ]]; then
echo "mysys : light-weight shell for windows"
exit 1;
elif [[ "$OSTYPE" == "win32" ]]; then
echo "Don't think we need it"
exit 1;
elif [[ "$OSTYPE" == "freebsd"* ]]; then
echo "BSD"
exit 1;
else
echo "No Support"
exit 1;
fi
}
function usage()
{
echo "Change your wallpaper dynamically to the Photo of the day of Nat Geo."
echo ""
echo "Arguments"
echo " -s : Initialize automation of wallpaper"
echo " -d : Stop|Delete automation of wallpaper"
echo ""; 1>&2; exit 1;
}
init
while getopts ":hsd" o; do
case "${o}" in
s)
(crontab -l ; echo "* * * * * $DIR/switcher.sh >> $DIR/log 2>&1") | crontab -
exit 1;
;;
d)
crontab -l | grep -v "$DIR/switcher.sh >> $DIR/log 2>&1" | crontab -
exit 1;
;;
h | *)
usage
exit 1;
;;
esac
done
shift $((OPTIND-1))
if [ -z "${s}" ] || [ -z "${p}" ]; then
usage
fi