-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·45 lines (38 loc) · 1.08 KB
/
install.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
#! /bin/bash
echo "Checking for chromium."
if [ ! $(which chromium) ]; then
echo "Chromium not found. Please install using apt-get."
exit 1
else
echo "Chromium found."
fi
if [ ! -f "mon.sh" ] ; then
echo "mon.sh not found. Exiting."
exit 1
fi
if [ ! -f "start_cmstv.sh" ] ; then
echo "start_cmstv.sh not found. Exiting."
exit 1
fi
MONSH_CMD=$(readlink -e mon.sh)
CMSTV_CMD=$(readlink -e start_cmstv.sh)
crontab -l > mycron.tab
if grep -q "start_cmstv" mycron.tab
then
echo "cmstv already found in user crontab. Crontab will not changed."
exit 1
else
echo "Appending cmstv scripts to crontab."
echo " 0 8 * * 1-5 ${MONSH_CMD} on" >> mycron.tab
echo " 0 20 * * * ${MONSH_CMD} off" >> mycron.tab
echo "*/5 * * * * ${CMSTV_CMD} > /dev/null" >> mycron.tab
fi
echo "Installing new crontab file..."
crontab mycron.tab
rm mycron.tab
AUTOSTARTFILE=/etc/xdg/lxsession/LXDE-pi/autostart
if [ -f "${AUTOSTARTFILE}" ] ; then
echo "Setting up autostart in LXDE."
echo "@${MONSH_CMD} on" >> ${AUTOSTARTFILE}
echo "@${CMSTV_CMD}" >> ${AUTOSTARTFILE}
fi