8 daemonctl - Manage preconfigured libslack daemon(1) daemons more conveniently
12 Daemonctl presumes some facts about the system:
16 =item daemons are configured in F</etc/daemon.conf>
18 =item daemons log to /syslog/daemon/daemon.<DAEMON>/today.log
30 .
/usr
/lib
/tool
/bash-utils
34 local daemon status pid started code
37 status
=`daemon -n "$daemon" -v --running 2>&1`
41 pid
=`head -n1 /var/run/daemons/$daemon.pid`
42 started
=`ps o lstart='' -p $pid`
43 status
="$status (running since $started)"
55 echo -n "known daemons: "
56 list_all_daemons |
tr "\n" " "
62 list_pidfile_daemons
()
64 ls -1 /var
/run
/daemons |
sed -e 's/\.pid$//'
67 _filter_daemon_names
()
69 perl
-ne '($s) = /^\s*(\S+)/; $s =~ /^[^*#]/ and print "$s\n"'
72 list_configured_daemons
()
74 cat /etc
/daemon.conf | perl
-pe 's/^#DISABLED# //' | _filter_daemon_names
77 list_enabled_daemons
()
79 cat /etc
/daemon.conf | _filter_daemon_names
86 list_configured_daemons
114 if list_enabled_daemons |
grep -qx "$daemon"
116 daemon
-n "$daemon" -v
118 errx
1 "$daemon: not sure, is it enabled in /etc/daemon.conf ?"
122 daemon
-n "$daemon" -v --stop
125 cat /etc
/daemon.conf | daemon
="$daemon" perl
-pe 's/^\Q$ENV{daemon}\E\s/#DISABLED# $&/' | sponge
/etc
/daemon.conf
128 cat /etc
/daemon.conf | daemon
="$daemon" perl
-pe 's/^#DISABLED# (\Q$ENV{daemon}\E)/$1/' | sponge
/etc
/daemon.conf
131 daemon
-n "$daemon" -v --restart
134 tail "$@" -f /syslog
/daemon
/daemon.
$daemon/`date +%Y%m%d`.log
138 # status is already shown above
142 warnx
"unknown verb '$verb'"
143 warnx
"valid verbs: start, restart, stop, log, disable, enable, status"