0

I would like a method as described here to set a watchdog to keep a python script alive, but in archlinux.

Thanks

EDIT

Solved using the example provided by smokes2345. I created a python_script.service in /etc/systemd/system/ with the following content:

[Service] Type=simple ExecStart=/home/fernando/PycharmProjects/get_tweets/get_tweets.py Restart=always

Camandros
  • 443
  • 3
  • 5
  • 13
  • In this case there's no need to specify the type as it defaults to simple. From the docs: "If set to simple (the default if neither Type= nor BusName=, but ExecStart= are specified)..." – smokes2345 Nov 23 '16 at 16:36

1 Answers1

1

Create a systemd service unit as described here and be sure to include the line "Restart=always". Systemd is the Arch equivalent of upstart. A minimal configuration would look like:

[Service]
ExecStart=<full path to script>
Restart=always

You may need to invoke the interpreter directly and provide your script as an argument depending on the shebang used in your script.

smokes2345
  • 845
  • 4
  • 18