====== /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:
[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
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]].
===== Launch something in a screen session =====
If you're looking for my jank-as-hell command that launches something in a screen session on behalf of a user, here it is:
sudo -H -u screen -dmS sh -c 'cd && ./'