forked from dst6se/aquatemp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_systemd
executable file
·50 lines (40 loc) · 1.01 KB
/
setup_systemd
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
#!/bin/bash
path=`pwd`
sysctlpath="/lib/systemd/system/"
if [ -z $1 ]; then
echo use with setup_systemctl install/uninstall
exit 1
fi
if [ $1 = "install" ]; then
cat > $sysctlpath/evoheat_control.service << EOF
[Unit]
Description=HeatPumpWater_Control
After=network-online.target
[Service]
Type=simple
ExecStart=${path}/control.sh
[Install]
WantedBy=multi-user.target
EOF
cat > $sysctlpath/evoheat_status.service << EOF
[Unit]
Description=HeatPumpWater_Status
After=network-online.target
[Service]
Type=simple
ExecStart=${path}/status.sh
[Install]
WantedBy=multi-user.target
EOF
systemctl enable evoheat_control.service
systemctl enable evoheat_status.service
systemctl start evoheat_control.service
systemctl start evoheat_status.service
elif [ $1 = "uninstall" ]; then
systemctl stop evoheat_control.service
systemctl stop evoheat_status.service
systemctl disable evoheat_control.service
systemctl disable evoheat_status.service
rm -f $sysctlpath/evoheat_control.service
rm -f $sysctlpath/evoheat_status.service
fi