I'm looking into 'porting' some custom init.d scripts that are in use on CentOS 6 boxes for use on CentOS 7 using systemd
One particular init.d script needs to run after autofs has been started, but before X11 is started
I'm guessing I could use something like:
After=autofs.service Before=graphical.target
Is this correct?
However, I would like to use the same systemd unit file on servers that won't run X - will the above work? Or is there a better/another way of doing this?
Thanks
James Pearson
Check out this page: https://scottlinux.com/2014/12/08/how-to-create-a-systemd-service-in-linux-c...
On 12/06/17 11:47 AM, James Pearson wrote:
I'm looking into 'porting' some custom init.d scripts that are in use on CentOS 6 boxes for use on CentOS 7 using systemd
One particular init.d script needs to run after autofs has been started, but before X11 is started
I'm guessing I could use something like:
After=autofs.service Before=graphical.target
Is this correct?
However, I would like to use the same systemd unit file on servers that won't run X - will the above work? Or is there a better/another way of doing this?
Thanks
James Pearson _______________________________________________ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
On Mon, Jun 12, 2017 at 03:47:46PM +0000, James Pearson wrote:
I'm guessing I could use something like:
After=autofs.service Before=graphical.target
Is this correct?
However, I would like to use the same systemd unit file on servers that won't run X - will the above work? Or is there a better/another way of doing this?
You probably want "display-manager.service" instead of "graphical.target".
You also will want "Requires=autofs.service". The distinction between "After/Before" and "Requires" is exactly for the reason you give; the ordering directives don't require anything, so without display-manager.service enabled, Before=display-manager.service is just a no-op. Actually, you might even want "BindsTo=autofs.service", which is stronger.
Depending on your setup, you many want to look at converting your automatic mounts into systemd mounts, and depend on that directly, rather than on the autofs service.
Matthew Miller wrote:
You probably want "display-manager.service" instead of "graphical.target".
You also will want "Requires=autofs.service". The distinction between "After/Before" and "Requires" is exactly for the reason you give; the ordering directives don't require anything, so without display-manager.service enabled, Before=display-manager.service is just a no-op. Actually, you might even want "BindsTo=autofs.service", which is stronger.
Thanks - that makes sense ...
Depending on your setup, you many want to look at converting your automatic mounts into systemd mounts, and depend on that directly, rather than on the autofs service.
It's one systemd (baby) step at a time for me at the moment - that's probably too much to consider :-)
Thanks
James Pearson