Score:0

nginx.service is not starting after mount

cn flag

I have a nginx that depends on a mounted drive.

My nginx.service has an entry with the RequiresMountsFor in the service unit like this:

[Unit]
RequiresMountsFor=/media/bar

But looks like it is still booting ahead of the mount point.

My mount cmd looks like this and on cron jobs @reboot:

mount -o bg,nolock,noac,actimeo=0 192.168.1.5:/foo/bar /media/bar

I'm not finding where it is going wrong. Here is config showing systemctl show nginx.service

...
Before=multi-user.target shutdown.target
After=foo-bar.mount sysinit.target network.target -.mount system.slice basic.target systemd-journald.socket
RequiresMountsFor=/media/bar
...
Score:0
ca flag

If you need to run specifically after cron, you may be able to add

Requires=cronie.service

in your unit file, which will wait for crond to start before trying the nginx service.

You may also have some luck moving the mount to /etc/fstab instead of as a cron. systemd automatically picks up mounts from there and creates appropriate mount files.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.