User Tools

Site Tools


rc.local_on_modern_systemd

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

rc.local_on_modern_systemd [2020/08/10 18:41] (current)
tkbletsc created
Line 1: Line 1:
 +====== /​etc/​rc.local on modern systemd ======
 +
 +So the systemd crew thinks that rc.local is bad or something and it's not enabled by default. Put it back by making this file:
 +
 +  sudo nano /​etc/​systemd/​system/​rc-local.service
 +
 +with content:
 +
 +<​code>​
 +[Unit]
 + ​Description=/​etc/​rc.local Compatibility
 + ​ConditionPathExists=/​etc/​rc.local
 + ​After=remote-fs.target
 +
 +[Service]
 + ​Type=forking
 + ​ExecStart=/​etc/​rc.local start
 + ​TimeoutSec=0
 + ​StandardOutput=tty
 + ​RemainAfterExit=yes
 + ​SysVStartPriority=99
 +
 +[Install]
 + ​WantedBy=multi-user.target
 +</​code>​
 +
 +Note: the "​After=remote-fs.target"​ is something I added so it would wait for NFS. If you don't need NFS to be up, you can remove that line.
 +
 +Enable this new service:
 +
 +  sudo systemctl enable rc-local
 +  ​
 +Make a new fresh rc.local:
 +
 +  printf '​%s\n'​ '#​!/​bin/​bash'​ 'exit 0' | sudo tee /​etc/​rc.local
 +  sudo chmod +x /​etc/​rc.local
 +
 +If that doesn'​t work, the coward'​s way out is to use the @reboot cron specifier. ​
 +
 +Source for the above: [[https://​www.linuxbabe.com/​linux-server/​how-to-enable-etcrc-local-with-systemd|this]] plus [[https://​forums.fedoraforum.org/​showthread.php?​290491-F18-NFS-and-rc-local|this for NFS support]].
  
rc.local_on_modern_systemd.txt ยท Last modified: 2020/08/10 18:41 by tkbletsc