User:Eroen/openrc-need-after

From Gentoo Wiki
Jump to: navigation, search

It appears that as of sys-apps/openrc-0.13.11 'need' and 'after' dependencies have subtly different semantics. Only 'need' dependencies cause the dependant to wait for the dependee to reach the "started" state, while 'after' and 'use' dependencies merely ensure services are started in the correct order.

occam ~ # rc-service openvpn.eroen-occam stop
 * Stopping openvpn.eroen-occam ...                                                        [ ok ]
occam ~ # rc-service openvpn.ipvanish-NO-Oslo-osl-c01 stop
 * Stopping openvpn.ipvanish-NO-Oslo-osl-c01 ...                                           [ ok ]
occam ~ # echo 'rc_after="openvpn.ipvanish-NO-Oslo-osl-c01"' >> /etc/conf.d/openvpn.eroen-occam
occam ~ # rc -n; sleep 0.1s; rc-status
 * Caching service dependencies ...
Service `udev-dev-tarball' needs non existent service `udev-mount'                         [ ok ]
 * Starting openvpn.ipvanish-NO-Oslo-osl-c01 ...
Tue Mar 10 07:52:40 2015 DEPRECATED OPTION: --tls-remote, please update your configuration [ ok ]
 * WARNING: openvpn.ipvanish-NO-Oslo-osl-c01 has started, but is inactive
 * Starting openvpn.eroen-occam ...
 * WARNING: You are dropping root privileges!
 * As such openvpn may not be able to change ip, routing
 * or DNS configuration.                                                                   [ ok ]
 * WARNING: openvpn.eroen-occam has started, but is inactive
Runlevel: default
 consolefont                                                                        [  started  ]
 sshd                                                                               [  started  ]
 actkbd                                                                             [  started  ]
 acpid                                                                              [  started  ]
 fcron                                                                              [  started  ]
 net.wlan0                                                                          [  started  ]
 cupsd                                                                              [  started  ]
 bitlbee                                                                            [  started  ]
 gpm                                                                                [  started  ]
 laptop_mode                                                                        [  started  ]
 microcode_ctl                                                                      [  started  ]
 netmount                                                                           [  started  ]
 ntpd                                                                               [  started  ]
 openvpn.ipvanish-NO-Oslo-osl-c01                                                   [ inactive  ]
 openvpn.eroen-occam                                                                [ inactive  ]
 samba                                                                              [  started  ]
 tor                                                                                [  started  ]
 udev-postmount                                                                     [  started  ]
 vnstatd                                                                            [  started  ]
 local                                                                              [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed
 lvmetad                                                                            [  started  ]
Dynamic Runlevel: manual

occam ~ # rc-service openvpn.ipvanish-NO-Oslo-osl-c01 stop
 * Stopping openvpn.ipvanish-NO-Oslo-osl-c01 ...                                           [ ok ]
occam ~ # rc-service openvpn.eroen-occam stop
 * Stopping openvpn.eroen-occam ...                                                        [ ok ]
occam ~ # echo 'rc_need="openvpn.ipvanish-NO-Oslo-osl-c01"' >> /etc/conf.d/openvpn.eroen-occam
occam ~ # rc -n; sleep 0.1s; rc-status
 * Caching service dependencies ...
Service `udev-dev-tarball' needs non existent service `udev-mount'                         [ ok ]
 * Starting openvpn.ipvanish-NO-Oslo-osl-c01 ...
Tue Mar 10 07:53:20 2015 DEPRECATED OPTION: --tls-remote, please update your configuration [ ok ]
 * WARNING: openvpn.ipvanish-NO-Oslo-osl-c01 has started, but is inactive
 * WARNING: openvpn.eroen-occam will start when openvpn.ipvanish-NO-Oslo-osl-c01 has started
Runlevel: default
 consolefont                                                                        [  started  ]
 sshd                                                                               [  started  ]
 actkbd                                                                             [  started  ]
 acpid                                                                              [  started  ]
 fcron                                                                              [  started  ]
 net.wlan0                                                                          [  started  ]
 cupsd                                                                              [  started  ]
 bitlbee                                                                            [  started  ]
 gpm                                                                                [  started  ]
 laptop_mode                                                                        [  started  ]
 microcode_ctl                                                                      [  started  ]
 netmount                                                                           [  started  ]
 ntpd                                                                               [  started  ]
 openvpn.ipvanish-NO-Oslo-osl-c01                                                   [ inactive  ]
 openvpn.eroen-occam                                                                [ scheduled ]
 samba                                                                              [  started  ]
 tor                                                                                [  started  ]
 udev-postmount                                                                     [  started  ]
 vnstatd                                                                            [  started  ]
 local                                                                              [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed
 lvmetad                                                                            [  started  ]
Dynamic Runlevel: manual

occam ~ # rc-service openvpn.eroen-occam stop
 * Caching service dependencies ...
Service `udev-dev-tarball' needs non existent service `udev-mount'                         [ ok ]
 * Stopping openvpn.eroen-occam ...                                                        [ ok ]
occam ~ # rc-service openvpn.ipvanish-NO-Oslo-osl-c01 stop
 * Stopping openvpn.ipvanish-NO-Oslo-osl-c01 ...                                           [ ok ]
occam ~ # vim /etc/conf.d/openvpn.eroen-occam
occam ~ # tail -n 2 /etc/conf.d/openvpn.eroen-occam
rc_after="openvpn.ipvanish-NO-Oslo-osl-c01"
rc_use="openvpn.ipvanish-NO-Oslo-osl-c01"
occam ~ # rc -n; sleep 0.1s; rc-status
 * Starting openvpn.ipvanish-NO-Oslo-osl-c01 ...
Tue Mar 10 08:03:40 2015 DEPRECATED OPTION: --tls-remote, please update your configuration [ ok ]
 * WARNING: openvpn.ipvanish-NO-Oslo-osl-c01 has started, but is inactive
 * Starting openvpn.eroen-occam ...
 * WARNING: You are dropping root privileges!
 * As such openvpn may not be able to change ip, routing
 * or DNS configuration.                                                                   [ ok ]
 * WARNING: openvpn.eroen-occam has started, but is inactive
Runlevel: default
 consolefont                                                                        [  started  ]
 sshd                                                                               [  started  ]
 actkbd                                                                             [  started  ]
 acpid                                                                              [  started  ]
 fcron                                                                              [  started  ]
 net.wlan0                                                                          [  started  ]
 cupsd                                                                              [  started  ]
 bitlbee                                                                            [  started  ]
 gpm                                                                                [  started  ]
 laptop_mode                                                                        [  started  ]
 microcode_ctl                                                                      [  started  ]
 netmount                                                                           [  started  ]
 ntpd                                                                               [  started  ]
 openvpn.ipvanish-NO-Oslo-osl-c01                                                   [ inactive  ]
 openvpn.eroen-occam                                                                [ inactive  ]
 samba                                                                              [  started  ]
 tor                                                                                [  started  ]
 udev-postmount                                                                     [  started  ]
 vnstatd                                                                            [  started  ]
 local                                                                              [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed
 lvmetad                                                                            [  started  ]
Dynamic Runlevel: manual