diff options
author | Sebastien Luttringer <seblu@seblu.net> | 2011-04-24 23:25:10 +0200 |
---|---|---|
committer | Sebastien Luttringer <seblu@seblu.net> | 2011-04-24 23:25:10 +0200 |
commit | 69b4aac9d13d3c4a6c4604cfb763033aa0dab3d6 (patch) | |
tree | 02989ad6e4a3d1cb5e37186a84e62525eb521e05 /rc | |
parent | cd0ec05a9682ccaaf8d288ab4685edf1c311ec8f (diff) | |
download | initscripts-69b4aac9d13d3c4a6c4604cfb763033aa0dab3d6.tar.xz |
rc cleaning run rc.d scripts
rc helper now call rc.d scripts in root directory with a clean environment.
Chosen vars came from init man page.
It allows to launch scripts from the command line, as if they had been launched by init
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
Diffstat (limited to 'rc')
-rwxr-xr-x | rc | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -43,8 +43,14 @@ case $1 in *) action=$1 shift + # set same environment variables as init + runlevel=$(/sbin/runlevel) + ENV="PATH='/bin:/usr/bin:/sbin:/usr/sbin'" + ENV+=" PREVLEVEL='${runlevel:0:1}'" + ENV+=" RUNLEVEL='${runlevel:2:1}'" + ENV+=" CONSOLE='${CONSOLE:-/dev/console}'" for i; do - [[ -x "/etc/rc.d/$i" ]] && "/etc/rc.d/$i" $action + [[ -x "/etc/rc.d/$i" ]] && cd / && eval /usr/bin/env -i $ENV "/etc/rc.d/$i" "$action" (( ret += $? )) done esac |