I am coming from SUSE, and they had a mechanism where if the file /etc/init.d/after.local existed then anything within it was executed after the boot process fully completed. It was convenient because I could do for example "nvidia-smi -pm 1" to set persistence enabled, I had to do this as root because the "persistence" doesn't persist across reboots. And you could do a bunch of other useful things, I would start flexlm license managers.
What is the way to do something like this in RHEL/CentOS 7.6 ?
Automatically execute a script or commands after boot finished
Re: Automatically execute a script or commands after boot finished
On RHEL/CentOS there is only /etc/rc.d/rc.local and its associated systemd unit file systemctl status rc-local. The file /etc/rc.d/rc.local contains instructions on how to make it work.
You can also just set up your own systemd unit file to do what you want and have them depend on the services that need to be up and running.
You can also just set up your own systemd unit file to do what you want and have them depend on the services that need to be up and running.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: Automatically execute a script or commands after boot finished
You may want to run yum update to get CentOS 7.8.
Here's an example of a flexlm systemd unit file:
# setup:
#https://gist.github.com/JesterEE/7d9c3d59aa663deeb92f
[Unit]
Description=software1 flexlm license server
After=network.target network.service
[Service]
User=flexlm
Group=flexlm
Environment=LICENSE_FILE=/full/path/to/license.dat
Environment=LOG_FILE=/full/path/to/license.log
WorkingDirectory=/full/path/to
ExecStart=/full/path/to/lmgrd -c $LICENSE_FILE -l $LOG_FILE
Restart=always
RestartSec=30
Type=forking
[Install]
# multiuser cli
WantedBy=multi-user.target
Here's an example of a flexlm systemd unit file:
# setup:
#https://gist.github.com/JesterEE/7d9c3d59aa663deeb92f
[Unit]
Description=software1 flexlm license server
After=network.target network.service
[Service]
User=flexlm
Group=flexlm
Environment=LICENSE_FILE=/full/path/to/license.dat
Environment=LOG_FILE=/full/path/to/license.log
WorkingDirectory=/full/path/to
ExecStart=/full/path/to/lmgrd -c $LICENSE_FILE -l $LOG_FILE
Restart=always
RestartSec=30
Type=forking
[Install]
# multiuser cli
WantedBy=multi-user.target