install.sh (778B)
1 #!/bin/bash 2 3 echo "run with sudo ./install.sh" 4 5 installfolder=" $(pwd)" 6 echo "$installfolder" 7 8 cat <<EOF > /etc/systemd/system/remoteconnect.service 9 [Unit] 10 Description=remoteconnect 11 After=multi-user.target 12 13 [Service] 14 Type=simple 15 ExecStart=$installfolder/remoteconnect.sh 16 User=root 17 Restart=always 18 RestartSec=3 19 StandardInput=tty-force 20 TTYPath=/dev/tty3 21 22 [Install] 23 WantedBy=multi-user.target 24 EOF 25 cat <<EOF > /etc/systemd/system/waterlife.service 26 [Unit] 27 Description=doorlock 28 After=multi-user.target 29 30 [Service] 31 Type=simple 32 ExecStart=/usr/bin/python3 $installfolder/waterlife.py 33 User=root 34 Restart=always 35 RestartSec=3 36 StandardInput=tty-force 37 TTYPath=/dev/tty1 38 39 [Install] 40 WantedBy=multi-user.target 41 EOF 42 systemctl enable waterlife 43 systemctl enable remoteconnect 44 systemctl daemon-reload 45