-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·42 lines (27 loc) · 958 Bytes
/
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
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
source ./install_src
echo -e $c_green"Creating install directory : "$s_dim"$DAEMON_PATH"$c_def $s_def
mkdir -p $DAEMON_PATH
echo -e $c_green"Installing files : "$s_dim"$(pwd) -> $SERVICE_PATH"$c_def $s_def
cp -R ./src/* $DAEMON_PATH
echo -e $c_green"Installing service in : "$s_dim"$SERVICE_PATH"$c_def $s_def
cat > $SERVICE_PATH.service <<- EOM
[Unit]
Description=Horloge LED
[Service]
Type=simple
User=root
ExecStart=/usr/bin/python3 /srv/aurora/reveil-daemon.py
[Install]
WantedBy=multi-user.target
EOM
systemctl daemon-reload
echo -e $c_green"Starting service in : "$s_dim"$SERVICE_PATH"$c_def $s_def
systemctl start $DAEMON_NAME
systemctl enable $DAEMON_NAME
# echo -e $c_green"Installing update cron job : "$s_dim"$DAEMON_PATH"$c_def $s_def
# (echo "0 3 * * * cd /home/pi/aurora/ ; sudo ./update.sh") > /etc/cron.daily/aurora-update