Run a script during Arch Linux boot process 1394/04/09

We will use a systemd service to run our script during boot process of Arch Linux. 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/my-script

[Install]
WantedBy=multi-user.target 

put your script in "/usr/bin/my-script" and make sure to make it executable. and then enable the service.

$ sudo chmod 755 /usr/bin/my-script
$ sudo systemctl enable myscript.service

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

Comments

No comments yet! Be the first to send one.

Any thoughts? Please leave a reply

I'll use your email to show your picture using gravatar. I hate spam too.
Back to home

I'm Arash Milani, hacker & happiness ninja.
@narmand is our teams's lab to experiment awesome things in it.

I write and talk about hacking, developing web apps, teamwork and designing for better user experience.

You can always contact me via me[at]arashmilani.com email address.