[manjaro] run a command at startup as root
Manjaro (and Arch) uses systemd as a system and service manager, which differs from Ubuntu’s upstart. Under Ubuntu it is enough to edit
/etc/rc.local and those commands are executed upon boot. How to mimic this functionality with systemd?
I found a nice solution in this thread, posted by patroclo7. Here I just copy his solution.
Create the file
/etc/rc.d/rc.local and make it executable (chmod u+x). In this file add the command(s) you want to execute at startup.
Then, create a service file for
/etc/systemd/system/rc-local.service with this content:
[Unit] Description=/etc/rc.local compatibility ConditionFileIsExecutable=/etc/rc.d/rc.local [Service] Type=oneshot ExecStart=/etc/rc.d/rc.local TimeoutSec=0 StandardOutput=tty RemainAfterExit=yes SysVStartPriority=99 [Install] WantedBy=multi-user.target
Finally, enable it:
systemctl enable rc-local
Now if you reboot, the commands in
rc.local will be executed with root privileges.
- patroclo7 at https://bbs.archlinux.org/viewtopic.php?id=154338