5

I want to use an RPi running Arch Linux to power an embedded device and I therefore need the RPi to launch a (Mono C#) application the moment after it has finished booting without the user having to do anything. I have seen tutorials of how to do this on Raspbian but not for Arch. Can anyone help please?

5

The preferred way to do this on Archlinux is to use systemd.

systemd is the default init framework, replacing initscripts. The services which are started by systemd can be found in the subfolders of /etc/systemd/system/. Services can be enabled using the systemctl command. For more information about systemd and how to write autostart scripts for it, see at systemd.

Create a new file in /etc/systemd/system (e.g. myscript.service) and add the following contents:

[Unit]
Description=My script

[Service]
ExecStart=/usr/bin/myscript

[Install]
WantedBy=multi-user.target

Then run the following commands :

chmod 755 /usr/bin/myscript
systemctl enable myscript.service

This example assumes you want your script to start up when the target multi-user is launched.

Note: In case you ever want to start a shell script, make sure you have #!/bin/bash in the first line of the script.

More info: Autostarting with Arch, Systemd

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.