-
Notifications
You must be signed in to change notification settings - Fork 0
/
demonic.sh
28 lines (23 loc) · 1021 Bytes
/
demonic.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
echo "Register a service: flask for flask_notification as a services in /etc/systemd/system/flask_notification.service"
{ echo "[Unit]";
echo "Description=flask server for serve autosys classification";
echo "After=network.target";
echo " ";
echo "[Service]";
echo "Type=simple"
echo "WorkingDirectory=$PWD";
echo "Environment="PATH=/home/$USER/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"";
echo "ExecStart=/home/$USER/anaconda3/bin/python notification.py";
echo "Restart=always"
echo "RestartSec=3"
echo " ";
echo "[Install]";
echo "WantedBy=default.target";
} | tee $PWD/flask_notification.service > /dev/null
mv flask_notification.service /home/$USER/.config/systemd/user/flask_notification.service
loginctl enable-linger $USER
systemctl --user daemon-reload
echo "start flask_notification service via systemctl"
systemctl --user start flask_notification.service
echo "enable flask_notification restart when system boot"
systemctl --user enable flask_notification