Good day,
I have spent days reviewing a problem related to the operation of the services in Systemd and the SysV scripts, but I have not obtained a resolution to my question in the documentation.
The main issue goes like this:
Right now we have 20 VMs, 10 failed, 10 active/succeeded. All of them have the same set up, completely. autofs configuration, grub, scripts, etc.
OS: RHEL 7.9
autofs to mount "on demand" the required FS for the scripts [SysV].
Beyond what the script and its functions do, the problem I found in the journal is that, on 10 of the servers, the autofs did not mount or did not have enough time to mount the required fs.
whereas, in the 10 that were successful, autofs was not turned on even when my script started.
This leads to two situations:
There is a function in the script that checks that autofs is turned on, if it is not, it will start it and go to sleep for 5 seconds.
but if the service is up the script continues normally.
When the service was down and was started by the script, the execution was successful.[everything goes normally]
When the autofs service was already up, the execution failed.[and the error is precisely that the required FS /mnt/mypath/ers was not mounted.]
So we are talking about the same script, same set up, same os version, same everything, I promise that everything is exactly the same, I cloned the machines myself.
At this point I have run out of anwers, about what or why it happened.
Why the autofs was up in some vms and off in the others?
What is supposed to be executed first, if in systemd I have autofs and the script is SysV?
Note:
in the journal, I can see the behavior as follows.
FAILED SERVERS LOGS
1: Autofs is up
2: the script runs
3: the script fails
4: and just after the failure, I see many entries that automount starts to set the FS.
So in effect my script fails because the required FS is not there at the moment.
SUCCEEDED SERVERS
1: Script runs
2: autofs is down
3: autofs is started by my script
4: Script goes to sleep
5: automount all the FS
6: Script continues and succeds
This is a brief step by step description of what I see in the logs.
IF NEEDED:
this is the chkconfig for each part of my script and functions.
main_script : chkconfig 3 82 18
functions : chkconfig 345 26 19
autofs_check : chkconfig 2345 26 89