Network dependent services

Services like netmount or fetchmail which depend on an available network connection could be started/stopped with the following additional setup:

Precondition
Precondition is that network management is done with dhcpcd.

Implementation
Get the patch for dhcpcd:

Get the patch for openrc:

Re-emerge both dhcpcd and openrc:

Add one line start_inactive=true to the init script:

Restart dhcpcd:

Later versions than the presently stable of net-misc/dhcpcd and sys-apps/openrc have not been tested with these patches. It does not work for sys-apps/openrc-0.16.4.

Result
Services having "need net" in their init.d scripts like fetchmail would then start after dhcpcd is started.

They will be stopped when dhcpcd turns inactive and will be restarted when dhcpcd is back.

This should be sufficient for most end user computers. For more complex requirements in dependency behaviour see OpenRC.