Restart service node-red and lightdm if errors

Hi all,
I would like that node-red service and lightdm service restarts after errors, and in case of lightdm service it must restart after node-red restart correctly

many thanks in advance
best regards

What OS are you using? If Linux based, you should do that via systemd. It can define restarts and dependencies.

I'm using Debian 11. Have you have an example?

Look up how to change the systemd startup scripts. My alternate node-red installer on my github has an example of making node-red dependent on other services. You can adapt that for the lightdm service.