I want to start Apache after mounting a NFS (GlusterFS) share, but it keeps starting before the mount step. I set the order in /etc/rc*.d/ but it didn't work.

I always can edit the scripts to sleep a few seconds or wait for the share, but I'd like to know what's the best/correct way to do so.

Thanks a lot.

In the /etc/rc.d directory there is also a file called rc.local, which is the rc file that init will run after everything else is done. So you could take off that from default startup sequence and put under rc.local

chkconfig httpd off
echo "/etc/init.d/httpd start" >> /etc/init.d/rc.local

this should work for above scenario unless you have some other requirement.

However, boot process should run according to naming order if you see SXX, KXX where XX is number [order].

You can also check rcorder depending upon availability in your distribution..

  • I already tried that. GlusterFS takes almost 20 seconds to mount the partition. Because of that, even using rc.local, Apache doesn't start. I guess I'll need to create a script to wait for GlusterFS vefore starting Apache. That's not a polite solution, but it works. – Steve Lacerda Jul 5 '14 at 22:58
  • though i won't put sleep 20 [or similar], i would simply execute on completion, i.e. one script for both services startup. In future it might well take seconds more than what it takes now, good luck )) – tike Jul 5 '14 at 23:08
  • That's exactly what I was thinking. I can check for mounted volumes and, only after that, start Apache. Thanks. – Steve Lacerda Jul 6 '14 at 2:42

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.