Skip to main content

As muru said, You can modify it just like below.

[Unit]
Description=b service
After=a.service

[Service]
Type=simple

#restart on failure and tries 5 times. If fail in all, then reboot the system
ExecStartPre=/usr/bin/python /home/pi/.clar/c.py
ExecStart=/usr/bin/python /home/pi/.clar/b.py
Restart=on-failure
RestartSec=15
StartLimitBurst=5
StartLimitInterval=2min
StartLimitAction=reboot

[Install]
WantedBy=schedulerWantedBy=a.service

Then you have to do sudo systemctl disable b.service and sudo systemctl enable b.service

As muru said, You can modify it just like below.

[Unit]
Description=b service
After=a.service

[Service]
Type=simple

#restart on failure and tries 5 times. If fail in all, then reboot the system
ExecStartPre=/usr/bin/python /home/pi/.clar/c.py
ExecStart=/usr/bin/python /home/pi/.clar/b.py
Restart=on-failure
RestartSec=15
StartLimitBurst=5
StartLimitInterval=2min
StartLimitAction=reboot

[Install]
WantedBy=scheduler.service

Then you have to do sudo systemctl disable b.service and sudo systemctl enable b.service

As muru said, You can modify it just like below.

[Unit]
Description=b service
After=a.service

[Service]
Type=simple

#restart on failure and tries 5 times. If fail in all, then reboot the system
ExecStartPre=/usr/bin/python /home/pi/.clar/c.py
ExecStart=/usr/bin/python /home/pi/.clar/b.py
Restart=on-failure
RestartSec=15
StartLimitBurst=5
StartLimitInterval=2min
StartLimitAction=reboot

[Install]
WantedBy=a.service

Then you have to do sudo systemctl disable b.service and sudo systemctl enable b.service

Source Link

As muru said, You can modify it just like below.

[Unit]
Description=b service
After=a.service

[Service]
Type=simple

#restart on failure and tries 5 times. If fail in all, then reboot the system
ExecStartPre=/usr/bin/python /home/pi/.clar/c.py
ExecStart=/usr/bin/python /home/pi/.clar/b.py
Restart=on-failure
RestartSec=15
StartLimitBurst=5
StartLimitInterval=2min
StartLimitAction=reboot

[Install]
WantedBy=scheduler.service

Then you have to do sudo systemctl disable b.service and sudo systemctl enable b.service