天青色等烟雨,而我在等你。

Run Custom Scripts on boot under Systemd

As archlinux has replaced initscripts with systemd as default init system and will start removing initscripts suppport, I use systemd now.

To be different from initscripts, rc scripts are no longer available. However it’s complicated to write a very .service boot script for each program. So solusion like this may be useful:

  1. Create a systemd-service-script which start a normal script and run it on boot.

  2. You can execute any command via the script mentioned in step 1.

In fact we are emulating the rc.local script which only works under initscripts.

The demo may look like this:

####custom.service:

[Unit]Description=Custom startup-scripts

[Service]ExecStart=/usr/bin/systemd_scripts_on_boot

[Install]WantedBy=multi-user.target

####systemd_scripts_on_boot:

#!/bin/bash

EXECUTE YOUR CUSTOM SCRIPT YOU WANT TO RUN ON STARTUP

I’m a newbie on linux, systemd and English. Please let me know if any bugs ^^

comments powered by Disqus