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



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

  • 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
    Commented Nov 23, 2016 at 16:36

1 Answer 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:

ExecStart=<full path to script>

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .