Hello Folks…!
I have an question here, boot.local in init.d is not available in suse distribution. is it available in any other names?
/etc/init.d/boot.local
I think this is basic question, but I cant able to find it in Google.
Thanks,
AK
Hello Folks…!
I have an question here, boot.local in init.d is not available in suse distribution. is it available in any other names?
/etc/init.d/boot.local
I think this is basic question, but I cant able to find it in Google.
Thanks,
AK
No. Create this file and make it executable.
But you better start with describing why you need this file and what you are trying to achieve. Most internet articles which mention boot.local are rather outdated.
If you need one for something you create one. Every *.local regular file in the /etc/ tree is a non-essential file that may contain configuration information specific to the system and will not be overwritten by normal system operations or software package management.
/etc/init.d/ is a compat directory, remaining present for legacy software not yet adapted to the systemd init system that replaced sysvinit on openSUSE many years ago.
If you think you need a boot.local file, what you probably should have instead is a custom systemd unit.
Hey There!
the requirement here is to execute the script during the system boot.
Hey mrmazda!
Good day!
the requirement here is to execute the script during the system boot.
can you help me out for the above requirement
Thanks in advance
To execute something during boot, better use systemd:
Another from an expert frequent contributor here.
See also man systemd.unit](systemd.unit) and man systemd.service](systemd.service).
Simple example to start something at boot.
Create a systemd-File with the name noip2.service in /etc/systemd/system/ with:
[Unit]
Description=DynDNS by NoIP
[Service]
Type=forking
ExecStart=/usr/local/bin/noip2
[Install]
WantedBy=multi-user.target
Enable at Boot:
systemctl enable noip2.service
Start:
systemctl start noip2.service
Status:
systemctl status noip2.service
=======================
This one just to run something once at boot.
#cat /etc/systemd/system/intel_turbo.service
[Unit]
Description=Disable intel pstate turbo
After=network.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo '1' > /sys/devices/system/cpu/intel_pstate/no_turbo"
[Install]
WantedBy=multi-user.target
Hey Henk!
Thanks for your comments…
I Think this oneshot method is good to go.
I have one more question, Do we need to create multiple systemd files for multiple command execution. or multiple commands can be added in single systemd file.
===
Thanks,
AK
I think you should have one ExecStart, but it is of course easy enough to gather a few of those commands in a script (e.g. in /usr/local/bin) and then start that script from the ExecStart.
And the total execution should not take much time. Else your boot process will start waiting for it to finish.
Remind that you better use absolute paths everywhere. No guarantee that environment variable you expect are there
Yeah, got it
Fine.
In general it is good to keep the ExecStart command as simple as possible (and thus in many cases call a script). I have seen people thinking that they could add there a long, multi command line ( with ; separated) and $… contstructs because they thought it is interpreted by bash. This is not the case. The interpretation is of course done by systemd and you have to consult the systemd docs to see what can be done there.