How to run nginx.service after /vagrant is mounted

前端 未结 5 599
青春惊慌失措
青春惊慌失措 2021-02-06 07:25

What I want to do?

I\'m trying to make nginx load configurations from /vagrant mounted by vagrant automatically.

So I edited nginx.service to make

5条回答
  •  无人及你
    2021-02-06 07:50

    I wrote a post how I'm using udev event to restart nginx and php5-fpm.

    In short I'm adding /etc/udev/rules.d/50-vagrant-mount.rules with rule:

    SUBSYSTEM=="bdi",ACTION=="add",RUN+="/bin/bash /root/.udev-mount-restart-services.sh"
    

    And the script /root/.udev-mount-restart-services.sh is:

    sleep 5 # wait for a bit for NFS to make sure resources are available
    systemctl restart php5-fpm > /dev/null 2>&1
    systemctl restart nginx > /dev/null 2>&1
    

提交回复
热议问题