I have the following service.
/etc/systemd/system/detectwifi.service
[Unit]
Description=wifi detect automation
Requires=wpa_supplicant.service
After=wpa_supplicant.service
[Service]
Type=simple
ExecStart=/sbin/wpa_cli -a /home/pi/test.sh -B
Restart=always
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Then I started the service, I have seen that the command wpa_cli -a /home/pi/test.sh -B
is running. Then killed the process and it won't restart again.
May I know the reason why the restart is not working?
Also If I comment the line RemainAfterExit=yes
, then the service will start to restart but it keeps on restart continuously even if the process run successfully.
Type=forking
since you startwpa_cli
in daemon mode. – Thomas Apr 22 '19 at 10:32