2 #ArchLinux Daemon Manager
4 if [ $
(whoami
) != "root" ]; then
5 echo 'You have to be root ;-P'
9 rc_conf
='/etc/rc.conf';
14 S
=$
(echo "$2" |
grep -o '[^!#@]*'); #remove flags
17 echo "${DAEMONS[*]}" |
tr ' ' "\n";
21 NEW
="DAEMONS=(${DAEMONS[*]})";
24 CONF
="$(cat $rc_conf)"
25 echo "$CONF" |
sed -ne '1h;1!H;${;g;s/DAEMONS=([^)]*)/'"$NEW"'/g;p;}' > "$rc_conf";
33 if [ "$S" != '' ]; then
34 ls -1 /var
/run
/daemons
/ |
grep ^
"$S"$
>/dev
/null
2>&1
35 if [ $?
== 0 ]; then echo -n 'running'; else echo -n 'stopped'; fi
36 whatis -l -L C
"$S" |
grep -o -e ' - \(.*\)$' | cut
-d '-' -f 2-
40 ls -1 "$rc_d" |
while read i
; do
45 DAEMONS
=($
(list |
sed "s/^\(!\|@\)$S$/$S/"));
49 DAEMONS
=($
(list |
sed "s/^!\?$S$/@$S/"));
53 DAEMONS
=($
(list |
sed "s/^@\?$S$/!$S/"));
60 echo "usage: $0 {list|whatis|enable-fg|enable-bg|disable|start|stop|restart} [service name]
62 Note that only daemons specified in $rc_conf can be manipulated - you must add them manually."