For example:
nginx
and php-cgi
are in the defaults run level, and they are not started yet.
What's the command to start them all, instead of starting then individually?
I know there is a command, but I totally forgot it.
Seems that rc-config
+ rc-status
is an answer, with some shell scripting. Running
rc-config list default
lists all the scripts in the runlevel default
. On the other hand, it uses colors and can mess things up, so an alternative app, rc-status
, does the trick:
rc-status -nc default
shows all services from runlevel default
without colors. We'll awk
from this:
rc-config start `rc-status -nc default | awk -v ORS=" " '/^ .+\[ stopped ]$/{print $1}'`
The regular expression pattern takes care that the entry must begin with a space, and end with "[ stopped ]
". When run with some stopped services, the oneliner does what you want. If there aren't any, rc-config
gives a simple syntax error, nothing happens.
I know this wasn't what you wanted, a single command, but it's easily wrapped in a script if you need it often! The programs lie in packages equery
and baselayout
so they should exist in every Gentoo installation.