Re: Is there an officially Fedora supported replacement for,> the old rc.local? - still an issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 18.07.2022 um 22:18 schrieb Peter Boy<pboy@xxxxxxxxxxxxx>: wrote

I got it finally working.
After some tests: It isn’t.

The programs I have to start depend on the existence of some (virtual) network interfaces. rc.local is ordered after network.target, which doesn’t mean, the network is functional then. Therefore, the program start via rc.local is in indeterministic process. Sometimes it works, sometimes not, sometimes only for some.

Documentation mentions a drop in at/etc/systemd/system/rc-local.service.d/network.conf. But there is no subdirectory /etc/systemd/system/rc-local.service.d/

Should I really mess around with vim and mkdir in the directories managed by the distribution? Seems like a bad idea to me.

Or have I missed something?

There is a cleaner workaround, which does, unfortunately mean you have to do some minor file amendments (with vim, *of course*!)

Your original /etc/rc.d/rc.local is renamed:
mv rc.local the-real-rc.local

/etc/rc.d/rc.local is replaced with a new version:
<code>
#!/bin/bash
#  to run rc.local type things, without interference from systemd
#  rc-local:
/usr/bin/at -M now <<'HERE' > /dev/null 2>&1
/etc/rc.d/the-real-rc.local
HERE

#  And everything I used to run in rc.local now gets run
#  from the-real-rc.local, untouched by systemd meddling
#  (Resistance was futile, I was assimilated).
</code>

Both of these files have to be executable (chmod 755).

The /usr/systemd/rc-local.service file IS NOT TOUCHED, so there are no problems with it being overwritten. (might need to be enabled. I cannot remember.)

The rc-local service checks the rc.local file, and IF it is executable, will run it. The new version rc.local calls 'the-real-rc.local'.

Your 'the-real-rc.local' file can have a sleep or structured pause until the networks respond properly and signal they are awake.

This sleight-of-hand was posted by someone on an Arch distro forum/mailing list. I do not have his name, but kudos and thanks whoever you are. It works

In addition, you can also split your 'real' file, by creating a semaphore file in /tmp, and run different sections. If you prefer you can run a 'real' files only on the first run after a boot, or even after an install. If you have not yet changed, for example, /var/lib/mysql from a directory to a link to somewhere else, then this is the first run after a re-install, and that has not yet been done: an install, in my experience, whether told to format or not to format, will wipe the /var partition, and all of the databases in that folder. I put them elsewhere and link to there, so no losses. So obviously one thing I want to do is change the folder to a link to the proper place. And obviously there are a plethora of things which need to be done *once* after an install. Needs one 'if' statement in the bash script. A re-run will skip the block.

Geoff





_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux