Question

I have a Python script on my Raspberry Pi running on Arch Linux ARM. To start the script, I use this command:

sudo python2 screen/screen.py

and it works perfectly. Now, my question is, how I can run this script automatically on start-up?

Was it helpful?

Solution

In the folder /etc/systemd/system/ make a file named screen.service

The contents of that file might look like this (change for your use):


[Unit]

Description=Launches screen with my config

After=network.target

[Service]

Type=simple

ExecStart=command_you_want_to_run

RemainAfterExit=true

[Install]

WantedBy=multi-user.target

When you're finished run systemctl enable screen.service

The WantedBy line tells systemd where to make the symlink.

To learn more about the options for service unit files check out the docs: man systemd.service

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top