Score:0

How to automatically restart Ubuntu service if it gets killed by OOM killer?

cn flag

In my case that service is Tor. System log (journalctl -k|grep -i tor) shows that the kernel is killing the service (or its parts?) due to OOM.

So i wanted to automatically restart tor?

ls /usr/lib/systemd/system/|grep -i tor
nano /usr/lib/systemd/system/tor.service

changed "Type=oneshot" to "Type=notify" because

Service has Restart= set to either always or on-success, which isn't allowed for Type=oneshot services. Refusing.

and then added lines into [Service] section of that file:

Restart=always
RestartSec=3

Ctrl+X to exit and then "systemctl daemon-reload;systemctl reload tor"

I did it correct, is there more simple way or what do You suggest please?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.