From 2800e50847f3217b60eb07138c7f6fda05467616 Mon Sep 17 00:00:00 2001 From: Sebastien Luttringer Date: Sat, 2 Apr 2011 12:39:05 +0200 Subject: Add an rc helper This is allow a quick calling to /etc/rc.d scripts by calling a shell command. By example, starting sshd and gpm can be done by typing: rc start sshd gpm rc can also list available scripts and show which is started/stopped in DAEMONS [tomegun: fixed detection of autostart of background services] Signed-off-by: Sebastien Luttringer Signed-off-by: Tom Gundersen --- functions | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'functions') diff --git a/functions b/functions index 2c3a6d5..fd0928e 100644 --- a/functions +++ b/functions @@ -175,6 +175,15 @@ have_daemon() { [[ -f /etc/rc.d/$1 && -x /etc/rc.d/$1 ]] } +# Check if $1 is started at boot +ck_autostart() { + local d + for d in "${DAEMONS[@]}"; do + [[ "$1" = ${d#@} ]] && return 1 + done + return 0 +} + start_daemon() { have_daemon "$1" && /etc/rc.d/"$1" start } -- cgit v1.2.3