vim /etc/systemd/system/frpc.service
```
[Unit]
Description=FRP Client Service
[Service]
ExecStart=/bin/bash /usr/local/frp/frpc_run.sh
[Install]
WantedBy=multi-user-target
```
In the .service file, I needed to add /bin/bash before the path to the script.
For example, for backup.service:
ExecStart=/bin/bash /home/user/.scripts/backup.sh
As opposed to:
ExecStart=/home/user/.scripts/backup.sh
```
sudo systemctl enable frpc
sudo service frpc start
```
```
sudo systemctl daemon-reload
```
```
$ sudo systemctl list-units |grep frpc
```
Python daemon and systemd service
```
#! /usr/bin/python3
```
chmod 777 xxx.py
```
[Unit]
Description=Auto Connect Wifi service
#Require=network.target
#After=syslog.target network.target remote-fs.target nss-lookup.target
#After=network.target
Conflicts=getty@tty1.service
After=multi-user.target
[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/home/lab001/workspace/startup-script/auto_connect/
#ExecStart=/home/lab001/workspace/startup-script/auto_connect/auto_connect.py
ExecStart=/usr/bin/python3 /home/lab001/workspace/startup-script/auto_connect/auto_connect.py
#ExecStart=/home/lab001/workspace/startup-script/auto_connect/auto_connect.sh
StandardInput=tty-force
StandardOutput=syslog
StandardError=syslog
#RestartSec=30
#Restart=on-failure
#Restart=on-abort
[Install]
WantedBy=multi-user.target
~
```
```
$ sudo systemctl daemon-reload && sudo systemctl restart auto_connect.service && sudo systemctl status auto_connect.service
```
Problem:
Failed to execute operation: Invalid argument
https://askubuntu.com/questions/814/how-to-run-scripts-on-start-up
https://haoyu.love/blog521.html
Automatically start long-running script on boot and keep it running with systemd
How do I figure out why systemctl service “systemd-modules-load” fails?