LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-14-2016, 06:38 AM   #1
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
Making sure NFS shares are up before proceeding with boot


I have a number of little slave (HTTP) servers, all of whom use NFS shares for everything so that I don't have to synchronize their little hard drives. Many things upon which Apache (and so on) depends are on those shares.

I'd like to make sure that systemd will start the NFS-client daemon, and wait for it to initialize, before proceeding with additional steps such as mounting the shares or starting Apache.

I know that systemd has a good dependencies-system (yay!!), including the ability to wait for things, but I've never really fiddled with it too much. Any pointers?
 
Old 12-15-2016, 04:11 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Have you considered a different approach where you change any startup scripts for service that require the NFS shares to check that they are available before starting the service and do this on a script by script basis rather than a dependencies basis.

If you have the checks on a service by service level then when you start/restart a service your checks can run and ensure the NFS share is there rather than looking at a previous "well it started on boot" style dependency "flag".
 
Old 12-15-2016, 10:06 AM   #3
Coffee!!!
LQ Newbie
 
Registered: Dec 2016
Distribution: RHEL
Posts: 18

Rep: Reputation: Disabled
You could modify the systemd unit for apache to start after nfs:

/usr/lib/systemd/system/httpd.service

Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target nfs-mountd.service
 
Old 12-16-2016, 12:13 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659

Original Poster
Blog Entries: 4

Rep: Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939Reputation: 3939
Yep, I think that After= is what I was "after."

What I am looking for is the ability to make sure that systemd will not attempt to start certain services (Apache, DNSMasq, etc.) until "after" the NFS service has been fully started. This should do nicely.

Ahh... "inittabs and crontabs." No, I don't miss them at all . . .

Last edited by sundialsvcs; 12-16-2016 at 12:16 PM.
 
Old 12-16-2016, 12:22 PM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
https://www.freedesktop.org/software...temd.unit.html

Good resource. You can also do the opposite - go to the nfs service and throw a 'Before=apache' or whatever in it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to configure an NFS server and mount NFS shares on Ubuntu 14.10 LXer Syndicated Linux News 0 11-26-2014 07:31 PM
[SOLVED] NFS shares not mounting at boot time 2handband Linux - Networking 8 01-15-2010 05:48 PM
Live CD not proceeding to second stage of boot after squashfs image editing cyber_apostle Programming 0 11-13-2009 02:34 AM
NFS shares not mounted at boot time hpladd Linux - Networking 6 12-06-2007 10:48 PM
nfs client does not mount server-shares automatically on boot rsp Debian 2 07-29-2007 07:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration