aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/acpid/acpid.rc40
-rwxr-xr-xsrc/ajaxterm/ajaxterm.rc40
-rwxr-xr-xsrc/alsa-utils/alsa62
-rwxr-xr-xsrc/apache/httpd65
-rwxr-xr-xsrc/apcupsd/apcupsd39
-rwxr-xr-xsrc/arptables/arptables.rc34
-rwxr-xr-xsrc/at/atd35
-rwxr-xr-xsrc/audit/auditd.rc51
-rwxr-xr-xsrc/autofs/autofs50
-rwxr-xr-xsrc/backuppc/backuppc.rc54
-rwxr-xr-xsrc/bftpd/bftpd.rc44
-rwxr-xr-xsrc/bind/named49
-rwxr-xr-xsrc/bird/bird.rc33
-rwxr-xr-xsrc/bitlbee/rc.d49
-rwxr-xr-xsrc/bluez/rc.bluetooth93
-rwxr-xr-xsrc/boinc/boinc.rc52
-rwxr-xr-xsrc/brltty/brltty68
-rwxr-xr-xsrc/capi4hylafax/capi4hylafax.rc49
-rwxr-xr-xsrc/catalyst-utils/atieventsd41
-rwxr-xr-xsrc/cdemu-daemon/cdemud.rc34
-rwxr-xr-xsrc/cgminer/cgminer51
-rwxr-xr-xsrc/chrony/rc.d37
-rwxr-xr-xsrc/clamav/rc.d66
-rwxr-xr-xsrc/collectd/rc.d39
-rwxr-xr-xsrc/connman/connmand-daemon44
-rwxr-xr-xsrc/conntrack-tools/conntrackd.rc34
-rwxr-xr-xsrc/couchdb/rc-script.patch57
-rwxr-xr-xsrc/cronie/rc.d38
-rwxr-xr-xsrc/cups/cups68
-rwxr-xr-xsrc/cyrus-sasl/saslauthd49
-rwxr-xr-xsrc/dante/sockd.rc68
-rwxr-xr-xsrc/darkstat/darkstat83
-rwxr-xr-xsrc/dbmail/dbmail.rc.d45
-rwxr-xr-xsrc/dbus-core/dbus51
-rwxr-xr-xsrc/ddclient/ddclient.rc41
-rwxr-xr-xsrc/deluge/deluge-web45
-rwxr-xr-xsrc/deluge/deluged43
-rwxr-xr-xsrc/dhcp/dhcp457
-rwxr-xr-xsrc/dhcp/dhcp657
-rwxr-xr-xsrc/dhcp/dhcpd40
-rwxr-xr-xsrc/dictd/dictd92
-rwxr-xr-xsrc/distcc/distccd38
-rwxr-xr-xsrc/dkfilter/dkfilter-rc76
-rwxr-xr-xsrc/dkms/dkms.rc34
-rwxr-xr-xsrc/dnsmasq/rc.dnsmasq64
-rwxr-xr-xsrc/dovecot/dovecot.sh69
-rwxr-xr-xsrc/drbd/drbd.rc58
-rwxr-xr-xsrc/dspam/dspam37
-rwxr-xr-xsrc/ebtables/ebtables.rc31
-rwxr-xr-xsrc/ejabberd/ejabberd63
-rwxr-xr-xsrc/espeakup/espeakup43
-rwxr-xr-xsrc/exabgp/exabgp.rc43
-rwxr-xr-xsrc/exim/exim42
-rwxr-xr-xsrc/fail2ban/rc.d40
-rwxr-xr-xsrc/fcgiwrap/fcgiwrap.rc.d74
-rwxr-xr-xsrc/fcron/fcron.rc36
-rwxr-xr-xsrc/ferm/ferm.rc26
-rwxr-xr-xsrc/fetchmail/fetchmail.rc38
-rwxr-xr-xsrc/fluidsynth/fluidsynth.rc40
-rwxr-xr-xsrc/freeradius/radiusd43
-rwxr-xr-xsrc/fssos-nsvs/nsvsd36
-rwxr-xr-xsrc/fuse/fuse.rc.d49
-rwxr-xr-xsrc/git/git-daemon70
-rwxr-xr-xsrc/gkrellm/gkrellmd40
-rwxr-xr-xsrc/glibc/nscd.rcd65
-rwxr-xr-xsrc/glusterfs/glusterd.rc39
-rwxr-xr-xsrc/gnump3d/gnump3d46
-rwxr-xr-xsrc/gnunet/gnunet.rc40
-rwxr-xr-xsrc/gpm/gpm41
-rwxr-xr-xsrc/gpsd/gpsd43
-rwxr-xr-xsrc/haveged/rc.d44
-rwxr-xr-xsrc/hdapsd/hdapsd.rc.d60
-rwxr-xr-xsrc/hddtemp/rc.d39
-rwxr-xr-xsrc/hostapd/hostapd35
-rwxr-xr-xsrc/hylafax/hylafax71
-rwxr-xr-xsrc/i8kmon/i8kmon.daemon39
-rwxr-xr-xsrc/icecast/icecastd66
-rwxr-xr-xsrc/ifplugd/ifplugd105
-rwxr-xr-xsrc/incron/incron.init34
-rwxr-xr-xsrc/inetutils/ftpd.rc37
-rwxr-xr-xsrc/inn/innd.rc47
-rwxr-xr-xsrc/inn/nnrpd.rc49
-rwxr-xr-xsrc/inputattach/inputattach.rc.d40
-rwxr-xr-xsrc/iperf/iperf.rc52
-rwxr-xr-xsrc/ipsec-tools/ipsec.rc35
-rwxr-xr-xsrc/ipsec-tools/racoon.rc35
-rwxr-xr-xsrc/ipset/ipset.rc33
-rwxr-xr-xsrc/iptables/ip6tables69
-rwxr-xr-xsrc/iptables/iptables68
-rwxr-xr-xsrc/ipvsadm/ipvsadm.rc31
-rwxr-xr-xsrc/irqbalance/irqbalance.rc.d46
-rwxr-xr-xsrc/jmc/jmc.rc53
-rwxr-xr-xsrc/kdebase-workspace/kdm36
-rwxr-xr-xsrc/keepalived/keepalived.rc38
-rwxr-xr-xsrc/kexec-tools/kexec45
-rwxr-xr-xsrc/krb5/krb5-kadmind40
-rwxr-xr-xsrc/krb5/krb5-kdc40
-rwxr-xr-xsrc/krb5/krb5-kpropd40
-rwxr-xr-xsrc/laptop-mode-tools/laptop-mode57
-rwxr-xr-xsrc/lastfmsubmitd/lastfmsubmitd60
-rwxr-xr-xsrc/lastfmsubmitd/lastmp60
-rwxr-xr-xsrc/libsasl/saslauthd49
-rwxr-xr-xsrc/libvirt/libvirtd-guests.rc.d161
-rwxr-xr-xsrc/libvirt/libvirtd.rc.d66
-rwxr-xr-xsrc/lighttpd/lighttpd.rc.d127
-rwxr-xr-xsrc/linux-tools/cpupower.rc16
-rwxr-xr-xsrc/linux-tools/usbipd.rc34
-rwxr-xr-xsrc/lirc/irexecd38
-rwxr-xr-xsrc/lirc/lircd52
-rwxr-xr-xsrc/lirc/lircmd36
-rwxr-xr-xsrc/lm_sensors/fancontrol.rc35
-rwxr-xr-xsrc/lm_sensors/healthd.rc36
-rwxr-xr-xsrc/lm_sensors/sensord.rc37
-rwxr-xr-xsrc/lm_sensors/sensors.rc119
-rwxr-xr-xsrc/lxdm/rc.d36
-rwxr-xr-xsrc/mailman/mailman.rc29
-rwxr-xr-xsrc/mariadb/rc.d77
-rwxr-xr-xsrc/mcelog/mcelog.rc37
-rwxr-xr-xsrc/mdadm/mdadm42
-rwxr-xr-xsrc/mediaproxy/mediaproxy.init32
-rwxr-xr-xsrc/memcached/memcached.sh63
-rwxr-xr-xsrc/metalog/metalog42
-rwxr-xr-xsrc/mfs/mfscgiserv36
-rwxr-xr-xsrc/mfs/mfschunkserver38
-rwxr-xr-xsrc/mfs/mfsmaster39
-rwxr-xr-xsrc/mfs/mfsmetalogger39
-rwxr-xr-xsrc/minbif/minbif49
-rwxr-xr-xsrc/minidlna/minidlna.rc76
-rwxr-xr-xsrc/miredo/isatapd.rc.d37
-rwxr-xr-xsrc/miredo/miredo-server.rc.d37
-rwxr-xr-xsrc/miredo/miredo.rc.d37
-rwxr-xr-xsrc/misdnuser/misdncapid.rc45
-rwxr-xr-xsrc/mongodb/mongodb.rc39
-rwxr-xr-xsrc/monit/monitd43
-rwxr-xr-xsrc/motion/rc.motion37
-rwxr-xr-xsrc/mpd/rc.d25
-rwxr-xr-xsrc/mpdscribble/rc.d37
-rwxr-xr-xsrc/multipath-tools/rc.d35
-rwxr-xr-xsrc/munin/munin-node.init42
-rwxr-xr-xsrc/murmur/murmur.rc.d44
-rwxr-xr-xsrc/mysql/mysqld.rc77
-rwxr-xr-xsrc/mythplugins/mtd.rc36
-rwxr-xr-xsrc/mythtv/mythbackend.rc73
-rwxr-xr-xsrc/nbd/nbd39
-rwxr-xr-xsrc/ndisc6/rdnssd.rc.d51
-rwxr-xr-xsrc/net-snmp/snmpd.rc39
-rwxr-xr-xsrc/netperf/netperf.rc41
-rwxr-xr-xsrc/nfs-utils/nfs-common315
-rwxr-xr-xsrc/nfs-utils/nfs-server299
-rwxr-xr-xsrc/nginx/rc.d68
-rwxr-xr-xsrc/ngircd/ngircd.sh36
-rwxr-xr-xsrc/noip/noip-rc.d39
-rwxr-xr-xsrc/ntop/ntop38
-rwxr-xr-xsrc/ntp/ntpd47
-rwxr-xr-xsrc/ntp/ntpdate29
-rwxr-xr-xsrc/oidentd/rc.d41
-rwxr-xr-xsrc/open-vm-tools/open-vm-tools.rc.d106
-rwxr-xr-xsrc/opendkim/opendkim.rc39
-rwxr-xr-xsrc/openfire/openfire57
-rwxr-xr-xsrc/openldap/slapd49
-rwxr-xr-xsrc/openntpd/openntpd38
-rwxr-xr-xsrc/opensips/opensips.init50
-rwxr-xr-xsrc/openslp/rc.slpd38
-rwxr-xr-xsrc/openssh/sshd44
-rwxr-xr-xsrc/openssh/sshd-close-sessions17
-rwxr-xr-xsrc/openvpn/openvpn-tapdev.rc40
-rwxr-xr-xsrc/openvpn/openvpn.rc43
-rwxr-xr-xsrc/osiris/osirisd.init35
-rwxr-xr-xsrc/osiris/osirismd.init35
-rwxr-xr-xsrc/oss/rc-script30
-rwxr-xr-xsrc/ossp/osspd.rc.d52
-rwxr-xr-xsrc/p3scan/rc.p3scan39
-rwxr-xr-xsrc/partimage/partimaged64
-rwxr-xr-xsrc/pcsclite/pcscd53
-rwxr-xr-xsrc/pdns-recursor/pdns-recursor.rc35
-rwxr-xr-xsrc/pdns/pdns.rc35
-rwxr-xr-xsrc/pdnsd/rc.d37
-rwxr-xr-xsrc/percona-server/mysqld.rc77
-rwxr-xr-xsrc/php/rc.d.php-fpm144
-rwxr-xr-xsrc/postfix/rc.d36
-rwxr-xr-xsrc/postgresql/postgresql.rcd79
-rwxr-xr-xsrc/postgrey/postgrey.rc74
-rwxr-xr-xsrc/pound/pound.init38
-rwxr-xr-xsrc/pound/pound.runit23
-rwxr-xr-xsrc/ppp/ppp36
-rwxr-xr-xsrc/pptpd/pptpd35
-rwxr-xr-xsrc/preload/rc.d97
-rwxr-xr-xsrc/privoxy/privoxy53
-rwxr-xr-xsrc/proftpd/proftpd41
-rwxr-xr-xsrc/prosody/prosody.rcd93
-rwxr-xr-xsrc/pyaimt/pyaim.rc53
-rwxr-xr-xsrc/pyicqt/pyicq.rc53
-rwxr-xr-xsrc/pymsnt/pymsn.rc53
-rwxr-xr-xsrc/pyrss/pyrss.rc53
-rwxr-xr-xsrc/quagga/quagga.rc33
-rwxr-xr-xsrc/quassel/rc.quassel41
-rwxr-xr-xsrc/radvd/radvd.rc39
-rwxr-xr-xsrc/redis/redis.d78
-rwxr-xr-xsrc/rfkill/rc.d38
-rwxr-xr-xsrc/rng-tools/rngd41
-rwxr-xr-xsrc/rp-pppoe/adsl35
-rwxr-xr-xsrc/rpcbind/rpcbind39
-rwxr-xr-xsrc/rsync/rsyncd37
-rwxr-xr-xsrc/rsyslog/rsyslog39
-rwxr-xr-xsrc/samba/samba54
-rwxr-xr-xsrc/sauerbraten/sauerbraten.rcd37
-rwxr-xr-xsrc/ser2net/ser2net.init54
-rwxr-xr-xsrc/slim/rc.d36
-rwxr-xr-xsrc/slmodem-utils/slmodem-alsa.rc.d39
-rwxr-xr-xsrc/slmodem-utils/slmodem.rc.d42
-rwxr-xr-xsrc/smartmontools/smartd.rc39
-rwxr-xr-xsrc/smbnetfs/rc-smbnetfs52
-rwxr-xr-xsrc/spamassassin/spamd55
-rwxr-xr-xsrc/speech-dispatcher/speechd.sh37
-rwxr-xr-xsrc/squid/squid48
-rwxr-xr-xsrc/sshguard/sshguard.rc27
-rwxr-xr-xsrc/sslh/sslh.rc34
-rwxr-xr-xsrc/stunnel/stunnel.rc.d44
-rwxr-xr-xsrc/subversion/svnserve42
-rwxr-xr-xsrc/supervisor/supervisord71
-rwxr-xr-xsrc/synergy/synergys.rc38
-rwxr-xr-xsrc/syslog-ng/syslog-ng.rc67
-rwxr-xr-xsrc/sysstat/sysstat25
-rwxr-xr-xsrc/tenshi/rc-script62
-rwxr-xr-xsrc/tftp-hpa/tftpd.rc38
-rwxr-xr-xsrc/timidity++/timidity++.sh38
-rwxr-xr-xsrc/tinc/tincd.rc42
-rwxr-xr-xsrc/tinyproxy/tinyproxy50
-rwxr-xr-xsrc/tomcat6/tomcat677
-rwxr-xr-xsrc/tomcat7/tomcat777
-rwxr-xr-xsrc/tor/tor44
-rwxr-xr-xsrc/trac/tracd48
-rwxr-xr-xsrc/transmission/transmissiond46
-rwxr-xr-xsrc/ucarp/ucarp.rc35
-rwxr-xr-xsrc/ufw/rc.d64
-rwxr-xr-xsrc/ulogd/ulogd.rc54
-rwxr-xr-xsrc/ultimate-ircd/ultimate-ircd54
-rwxr-xr-xsrc/unbound/rc.d39
-rwxr-xr-xsrc/unrealircd/unrealircd.rc62
-rwxr-xr-xsrc/uptimed/rc.d39
-rwxr-xr-xsrc/usermin/usermin.rc44
-rwxr-xr-xsrc/ushare/ushare56
-rwxr-xr-xsrc/varnish/rc.varnish49
-rwxr-xr-xsrc/vde2/vde.rc113
-rwxr-xr-xsrc/virtualbox/vboxservice.rc39
-rwxr-xr-xsrc/virtualbox/vboxweb.rc86
-rwxr-xr-xsrc/vsftpd/vsftpd.d67
-rwxr-xr-xsrc/watchdog/watchdog.sh44
-rwxr-xr-xsrc/webfs/webfsd.rc38
-rwxr-xr-xsrc/webmin/webmin.rc46
-rwxr-xr-xsrc/wesnoth/wesnothd.rc.d40
-rwxr-xr-xsrc/wicd/wicd-daemon27
-rwxr-xr-xsrc/x11vnc/rc.d37
-rwxr-xr-xsrc/xinetd/xinetd38
-rwxr-xr-xsrc/xl2tpd/xl2tpd.rc39
-rwxr-xr-xsrc/xmms2/xmms2d.rc39
-rwxr-xr-xsrc/xsp/xsp.rc.d40
-rwxr-xr-xsrc/yahoo-t/yahoo.rc53
-rwxr-xr-xsrc/ypbind-mt/ypbind35
-rwxr-xr-xsrc/ypserv/yppasswd34
-rwxr-xr-xsrc/ypserv/ypserv34
261 files changed, 13224 insertions, 0 deletions
diff --git a/src/acpid/acpid.rc b/src/acpid/acpid.rc
new file mode 100755
index 0000000..674f462
--- /dev/null
+++ b/src/acpid/acpid.rc
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+[[ -f /etc/conf.d/acpid ]] && . /etc/conf.d/acpid
+
+PID=$(pidof -o %PPID /usr/sbin/acpid)
+case "$1" in
+ start)
+ stat_busy "Starting acpid"
+ [ -z "$PID" ] && /usr/sbin/acpid $ACPID_ARGS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon acpid
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping acpid"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon acpid
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/ajaxterm/ajaxterm.rc b/src/ajaxterm/ajaxterm.rc
new file mode 100755
index 0000000..5c572cd
--- /dev/null
+++ b/src/ajaxterm/ajaxterm.rc
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PORT=8022
+
+case "$1" in
+ start)
+ stat_busy "Starting ajaxterm on port $PORT"
+ /usr/bin/ajaxterm -p $PORT -d >/dev/null 2>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ajaxterm
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ajaxterm"
+ [ -f /var/run/ajaxterm.pid ] && kill `cat /var/run/ajaxterm.pid`
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /var/run/ajaxterm.pid
+ rm_daemon ajaxterm
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/src/alsa-utils/alsa b/src/alsa-utils/alsa
new file mode 100755
index 0000000..1e7b57f
--- /dev/null
+++ b/src/alsa-utils/alsa
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/conf.d/alsa
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Restoring ALSA Levels"
+ if [[ ! -e /var/lib/alsa/asound.state ]]; then
+ /usr/sbin/alsactl $ALSA_ARGS store || { stat_fail; exit 1; }
+ fi
+ if /usr/sbin/alsactl $ALSA_ARGS restore; then
+ stat_done
+ add_daemon alsa
+ else
+ stat_fail
+ exit 1
+ fi
+
+ POWERSAVE=${POWERSAVE:-0}
+ if [[ -e /sys/module/snd_ac97_codec/parameters/power_save ]] \
+ && (( $POWERSAVE )); then
+ echo $POWERSAVE > /sys/module/snd_ac97_codec/parameters/power_save
+ [[ -c /dev/dsp ]] && echo 1 > /dev/dsp
+ fi
+ if [[ -e /sys/module/snd_hda_intel/parameters/power_save ]] \
+ && (( $POWERSAVE )); then
+ echo $POWERSAVE > /sys/module/snd_hda_intel/parameters/power_save
+ [[ -c /dev/dsp ]] && echo 1 > /dev/dsp
+ fi
+ ;;
+ stop)
+ SAVE_VOLUME=${SAVE_VOLUME:-yes}
+ if [[ "$SAVE_VOLUME" = "yes" ]]; then
+ stat_busy "Saving ALSA Levels"
+ /usr/sbin/alsactl $ALSA_ARGS store || { stat_fail; exit 1; }
+ else
+ stat_busy "Stopping ALSA"
+ fi
+ if [ "$MUTE_VOLUME" == "yes" ]; then
+ /usr/bin/amixer -q set Master 0 mute || { stat_fail; exit 1; }
+ fi
+ stat_done
+ rm_daemon alsa
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ force-restart)
+ stat_busy "Trying to TERM or KILL processes that are blocking ALSA..."
+ FILES="$(ls -1 /dev/snd/* | grep -vi control)"
+ fuser -k -SIGTERM $FILES
+ fuser -k $FILES
+ stat_done
+ $0 restart
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|force-restart}"
+esac
diff --git a/src/apache/httpd b/src/apache/httpd
new file mode 100755
index 0000000..6fa9c3c
--- /dev/null
+++ b/src/apache/httpd
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+daemon_name=httpd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+APACHECTL=/usr/sbin/apachectl
+
+case "$1" in
+ start)
+ stat_busy "Starting Apache Web Server"
+ [ ! -d /var/run/httpd ] && install -d /var/run/httpd
+ if $APACHECTL start >/dev/null ; then
+ add_daemon $daemon_name
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping Apache Web Server"
+ if $APACHECTL stop >/dev/null ; then
+ rm_daemon $daemon_name
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ reload)
+ stat_busy "Reloading Apache Web Server"
+ if $APACHECTL graceful >/dev/null ; then
+ add_daemon $daemon_name
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ restart)
+ stat_busy "Restarting Apache Web Server"
+ if $APACHECTL restart >/dev/null ; then
+ add_daemon $daemon_name
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ status)
+ stat_busy "Checking Apache Web Server status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|reload|restart|status}"
+esac
+
+exit 0
diff --git a/src/apcupsd/apcupsd b/src/apcupsd/apcupsd
new file mode 100755
index 0000000..8a96e9b
--- /dev/null
+++ b/src/apcupsd/apcupsd
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /sbin/apcupsd`
+case "$1" in
+ start)
+ stat_busy "Starting APCUPSD Daemon"
+ [ -z "$PID" ] && /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon apcupsd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping APCUPSD Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon apcupsd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ status)
+ /sbin/apcaccess status
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+exit 0
diff --git a/src/arptables/arptables.rc b/src/arptables/arptables.rc
new file mode 100755
index 0000000..a188c65
--- /dev/null
+++ b/src/arptables/arptables.rc
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+case "$1" in
+ start)
+ stat_busy 'Loading arptables rules'
+ arptables-restore < "$CONFIG_FILE" &&
+ add_daemon ${0##*/} && stat_done || stat_die
+ ;;
+ stop)
+ [[ $SAVE_ON_STOP =~ [yY][eE][sS] ]] && $0 save
+ stat_busy 'Clearing arptables rules'
+ arptables-restore < /dev/null &&
+ rm_daemon ${0##*/} && stat_done || stat_die
+ ;;
+ restart)
+ $0 start
+ $0 stop
+ ;;
+ save)
+ stat_busy 'Saving arptables rules'
+ arptables-save > "$CONFIG_FILE" &&
+ stat_done || stat_die
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart|save}" >&2
+ exit 1
+ ;;
+esac
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/at/atd b/src/at/atd
new file mode 100755
index 0000000..d10a46a
--- /dev/null
+++ b/src/at/atd
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/atd`
+case "$1" in
+ start)
+ stat_busy "Starting ATD Daemon"
+ [ -z "$PID" ] && /usr/sbin/atd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon atd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ATD Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon atd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/audit/auditd.rc b/src/audit/auditd.rc
new file mode 100755
index 0000000..1397634
--- /dev/null
+++ b/src/audit/auditd.rc
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID auditd`
+
+case "$1" in
+ start)
+ stat_busy "Starting auditd"
+ [ -z "$PID" ] && {
+ /usr/sbin/auditctl -R /etc/audit/audit.rules >/dev/null || stat_die
+ /usr/sbin/auditd || stat_die
+ }
+ add_daemon auditd
+ stat_done
+ ;;
+
+ stop)
+ stat_busy "Stopping auditd"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon auditd
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ reload)
+ stat_busy "Reloading auditd"
+ [ ! -z "$PID" ] && kill -HUP $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon auditd
+ stat_done
+ fi
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|reload}"
+esac
+
+exit 0
diff --git a/src/autofs/autofs b/src/autofs/autofs
new file mode 100755
index 0000000..08bd3e1
--- /dev/null
+++ b/src/autofs/autofs
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+daemon_name=autofs
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+# source application-specific settings
+[ -f /etc/conf.d/autofs ] && . /etc/conf.d/autofs
+
+if [ ! -z "$TIMEOUT" ]; then
+ daemonoptions="--timeout=$TIMEOUT $daemonoptions"
+fi
+
+PID=`cat /var/run/autofs-running 2> /dev/null`
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name daemon"
+ [ -z "$PID" ] && /usr/sbin/automount $daemonoptions &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+ restart)
+ stat_busy "Restarting $daemon_name daemon"
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+exit 0
diff --git a/src/backuppc/backuppc.rc b/src/backuppc/backuppc.rc
new file mode 100755
index 0000000..f3b4a02
--- /dev/null
+++ b/src/backuppc/backuppc.rc
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+DAEMON=/usr/share/backuppc/bin/BackupPC
+
+PIDFILE=${PIDFILE:-/var/log/backuppc/BackupPC.pid}
+DAEMON_OPTS=${DAEMON_OPTS:--d}
+DAEMON_USER=${DAEMON_USER:-backuppc}
+DAEMON_GROUP=${DAEMON_GROUP:-nobody}
+
+case "$1" in
+ start)
+ stat_busy "Starting ${0##*/} daemon"
+ if start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
+ -c $DAEMON_USER -g $DAEMON_GROUP --startas $DAEMON -- \
+ $DAEMON_OPTS; then
+ stat_done
+ add_daemon ${0##*/}
+ exit 0
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ${0##*/} daemon"
+ if start-stop-daemon --stop --quiet --pidfile "$PIDFILE"; then
+ rm_daemon ${0##*/}
+ rm "$PIDFILE"
+ stat_done
+ exit 0
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ reload)
+ stat_busy "Reloading ${0##*/} dameon"
+ start-stop-daemon --stop --signal HUP --quiet --pidfile "$PIDFILE" \
+ && { stat_done; exit 0; } || { stat_fail; exit 1; }
+ ;;
+ restart)
+ $0 stop && sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ ;;
+esac
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/bftpd/bftpd.rc b/src/bftpd/bftpd.rc
new file mode 100755
index 0000000..4784ae2
--- /dev/null
+++ b/src/bftpd/bftpd.rc
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PIDFILE="/var/run/bftpd.pid"
+
+case "$1" in
+ start)
+ stat_busy "Starting bftpd Server"
+ PID="$(pidof -o %PPID /usr/bin/bftpd)"
+ if [ -z "$PID" ]; then
+ /usr/bin/bftpd -d
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ # wait until it forks
+ sleep 2
+ echo $(pidof -o %PPID /usr/bin/bftpd) > $PIDFILE
+ add_daemon bftpd
+ stat_done
+ fi
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping bftpd Server"
+ if [ -f $PIDFILE ] && kill -0 $(cat $PIDFILE); then
+ kill -15 $(cat $PIDFILE)
+ rm $PIDFILE
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/bind/named b/src/bind/named
new file mode 100755
index 0000000..65dd0fe
--- /dev/null
+++ b/src/bind/named
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/named
+
+PIDFILE=/run/named/named.pid
+PID=$(cat $PIDFILE 2>/dev/null)
+readlink -q /proc/$PID/exe | grep -q '^/usr/sbin/named' || { PID=; rm $PIDFILE 2>/dev/null; }
+
+case "$1" in
+ start)
+ stat_busy "Starting BIND"
+ [ -z "$PID" ] && /usr/sbin/named ${NAMED_ARGS}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon named
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping BIND"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon named
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ reload)
+ stat_busy "Reloading BIND"
+ [ ! -z "$PID" ] && rndc reload &>/dev/null || kill -HUP $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+ *)
+ echo "usage: $0 {start|stop|reload|restart}"
+esac
+exit 0
diff --git a/src/bird/bird.rc b/src/bird/bird.rc
new file mode 100755
index 0000000..a3aa5e4
--- /dev/null
+++ b/src/bird/bird.rc
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+DAEMON=/usr/sbin/${0##*/}
+PID=$(pidof -o %PPID $DAEMON)
+
+case "$1" in
+ start)
+ stat_busy "Starting ${0##*/} daemon"
+ [[ ! $PID ]] && $DAEMON $DAEMON_OPTS && add_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ stop)
+ stat_busy "Stopping ${0##*/} daemon"
+ [[ $PID ]] && kill $PID &> /dev/null && rm_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit 0
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ ;;
+esac
+
+exit 1
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/bitlbee/rc.d b/src/bitlbee/rc.d
new file mode 100755
index 0000000..ade8522
--- /dev/null
+++ b/src/bitlbee/rc.d
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+pidfile=/run/bitlbee/bitlbee.pid
+if [[ -r $pidfile ]]; then
+ read -r PID < "$pidfile"
+ if [[ ! -d /proc/$PID ]]; then
+ # stale pidfile
+ unset PID
+ rm -f "$pidfile"
+ fi
+fi
+
+case $1 in
+ start)
+ stat_busy "Starting bitlbee daemon"
+ if [[ $PID ]] || ! su -s /bin/sh -c '/usr/sbin/bitlbee -F' bitlbee; then
+ stat_fail
+ exit 1
+ else
+ add_daemon bitlbee
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping bitlbee daemon"
+ if [[ -z $PID ]] || ! kill $PID &>/dev/null; then
+ stat_fail
+ exit 1
+ else
+ rm -f "$pidfile"
+ rm_daemon bitlbee
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ exit 1
+ ;;
+esac
+
+# vim: set ft=sh et ts=2 sw=2:
diff --git a/src/bluez/rc.bluetooth b/src/bluez/rc.bluetooth
new file mode 100755
index 0000000..0feeaea
--- /dev/null
+++ b/src/bluez/rc.bluetooth
@@ -0,0 +1,93 @@
+#!/bin/bash
+#
+# Start/stop the Bluetooth daemons
+#
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DAEMON_NAME="bluetoothd"
+HIDD_NAME="hidd"
+RFCOMM_NAME="rfcomm"
+PAND_NAME="pand"
+DUND_NAME="dund"
+
+DAEMON_EXEC="/usr/sbin/bluetoothd"
+HIDD_EXEC="/usr/bin/hidd"
+RFCOMM_EXEC="/usr/bin/rfcomm"
+PAND_EXEC="/usr/bin/pand"
+DUND_EXEC="/usr/bin/dund"
+
+DAEMON_ENABLE="true"
+HIDD_ENABLE="false"
+RFCOMM_ENABLE="false"
+PAND_ENABLE="false"
+DUND_ENABLE="false"
+
+RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"
+
+HIDD_OPTIONS=""
+PAND_OPTIONS=""
+DUND_OPTIONS=""
+
+[ -f /etc/conf.d/bluetooth ] && . /etc/conf.d/bluetooth
+
+case "$1" in
+ start)
+ stat_busy "Starting bluetooth subsystem:"
+ if [ "$DAEMON_ENABLE" = "true" -a -x "$DAEMON_EXEC" ] ; then
+ stat_append " $DAEMON_NAME"
+ $DAEMON_EXEC
+ sleep 1
+ fi
+ if [ "$HIDD_ENABLE" = "true" -a -x "$HIDD_EXEC" ]; then
+ stat_append " $HIDD_NAME"
+ $HIDD_EXEC $HIDD_OPTIONS
+ fi
+ if [ "$RFCOMM_ENABLE" = "true" -a -x "$RFCOMM_EXEC" -a -f "$RFCOMM_CONFIG" ]; then
+ stat_append " $RFCOMM_NAME"
+ $RFCOMM_EXEC -f $RFCOMM_CONFIG bind all
+ fi
+ if [ "$PAND_ENABLE" = "true" -a -x "$PAND_EXEC" -a -n "$PAND_OPTIONS" ]; then
+ stat_append " $PAND_NAME"
+ $PAND_EXEC $PAND_OPTIONS
+ fi
+ if [ "$DUND_ENABLE" = "true" -a -x "$DUND_EXEC" -a -n "$DUND_OPTIONS" ]; then
+ stat_append " $DUND_NAME"
+ $DUND_EXEC $DUND_OPTIONS
+ fi
+ add_daemon bluetooth
+ stat_done
+ ;;
+ stop)
+ stat_busy "Stopping bluetooth subsystem:"
+
+ stat_append " $DUND_NAME"
+ killall $DUND_NAME >/dev/null 2>&1
+
+ stat_append " $PAND_NAME"
+ killall $PAND_NAME >/dev/null 2>&1
+
+ if [ -x "$RFCOMM_EXEC" ]; then
+ stat_append " $RFCOMM_NAME"
+ $RFCOMM_EXEC release all >/dev/null 2>&1
+ fi
+
+ stat_append " $HIDD_NAME"
+ killall $HIDD_NAME >/dev/null 2>&1
+
+ stat_append " $DAEMON_NAME"
+ killall $DAEMON_NAME >/dev/null 2>&1
+
+ rm_daemon bluetooth
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/boinc/boinc.rc b/src/boinc/boinc.rc
new file mode 100755
index 0000000..160043a
--- /dev/null
+++ b/src/boinc/boinc.rc
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+
+BOINCUSER="boinc"
+BOINCDIR="/var/lib/boinc"
+PID=`pidof -o %PPID /usr/bin/boinc_client`
+case "$1" in
+ attach)
+ echo "Enter the Project URL: "
+ read url
+ echo "Enter your Account Key: "
+ read key
+ echo "Attaching to project"
+ cd $BOINCDIR
+ su $BOINCUSER -c "boinccmd --project_attach $url $key"
+;;
+ start)
+ stat_busy "Starting boinc"
+ if [ -z "$PID" ]; then
+ su $BOINCUSER -c "nice -n 19 /usr/bin/boinc_client --daemon --dir ${BOINCDIR} --redirectio"
+ else
+ false
+ fi
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon boinc
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping boinc"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon boinc
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {attach|start|stop|restart}"
+esac
+exit 0
diff --git a/src/brltty/brltty b/src/brltty/brltty
new file mode 100755
index 0000000..5ed21a5
--- /dev/null
+++ b/src/brltty/brltty
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+daemon_name=brltty
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/$daemon_name.conf
+
+get_pid() {
+ pidof -o %PPID $daemon_name
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name daemon"
+
+ PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
+ # RUN
+ $daemon_name $brltty_args
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo $(get_pid) > /var/run/$daemon_name.pid
+ add_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ PID=$(get_pid)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/$daemon_name.pid &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/src/capi4hylafax/capi4hylafax.rc b/src/capi4hylafax/capi4hylafax.rc
new file mode 100755
index 0000000..51025b0
--- /dev/null
+++ b/src/capi4hylafax/capi4hylafax.rc
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/c2faxrecv`
+case "$1" in
+ start)
+ stat_busy "Starting capi4hylafax"
+ if [ -z "$PID" ]; then
+ /usr/bin/c2faxrecv > /dev/null &
+ faxmodem faxCAPI
+ fi
+ if [ ! -f /var/run/faxq.pid ]; then
+ stat_fail
+ echo "ERROR: hylafax is not running"
+ exit 1
+ fi
+ if [ ! -f /var/run/hfaxd.pid ]; then
+ stat_fail
+ echo "ERROR: hylafax is not running"
+ exit 1
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon capi4hylafax
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping capi4hylafax"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon capi4hylafax
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/catalyst-utils/atieventsd b/src/catalyst-utils/atieventsd
new file mode 100755
index 0000000..16bd9a4
--- /dev/null
+++ b/src/catalyst-utils/atieventsd
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+ATID_PID=`pidof -o %PPID /usr/sbin/atieventsd`
+
+case "$1" in
+ start)
+ rc=0
+ stat_busy "Starting ATI Events Daemon"
+ [ -z "$ATID_PID" ] && /usr/sbin/atieventsd
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon atieventsd
+ stat_done
+ fi
+ ;;
+ stop)
+ rc=0
+ stat_busy "Stopping ATI Events Daemon"
+ kill $ATID_PID &>/dev/null
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon atieventsd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/cdemu-daemon/cdemud.rc b/src/cdemu-daemon/cdemud.rc
new file mode 100755
index 0000000..09b9ec3
--- /dev/null
+++ b/src/cdemu-daemon/cdemud.rc
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting cdemud"
+ /usr/lib/cdemu-daemon/cdemu-daemon-system.sh &
+ if [ $? -ne 0 ]; then
+ stat_fail
+ else
+ add_daemon cdemud
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping cdemud"
+ kill `pidof cdemud` &>/dev/null
+ if [ $? -ne 0 ]; then
+ stat_fail
+ else
+ rm_daemon cdemud
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/cgminer/cgminer b/src/cgminer/cgminer
new file mode 100755
index 0000000..9081e8e
--- /dev/null
+++ b/src/cgminer/cgminer
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DAEMON=cgminer
+
+# stupid patch var
+export HOME=/root
+
+[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON
+
+if [ -r $CGMINER_CONF ]; then
+ ARGS="--config $CGMINER_CONF $CGMINER_ARGS"
+else
+ ARGS="--url $CGMINER_PROTOCOL://$CGMINER_IP:$CGMINER_PORT --user $CGMINER_USER --pass $CGMINER_PASS $CGMINER_ARGS"
+fi
+
+PID=$(get_pid $DAEMON)
+
+case "$1" in
+ start)
+ stat_busy "Starting $DAEMON"
+ [ -z "$PID" ] && $DAEMON $ARGS &>/dev/null &
+ if [ $? = 0 ]; then
+ add_daemon $DAEMON
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping $DAEMON"
+ [ -n "$PID" ] && kill $PID &>/dev/null
+ if [ $? = 0 ]; then
+ rm_daemon $DAEMON
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/chrony/rc.d b/src/chrony/rc.d
new file mode 100755
index 0000000..ec042d7
--- /dev/null
+++ b/src/chrony/rc.d
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/chronyd`
+case "$1" in
+ start)
+ stat_busy "Starting chrony Daemon"
+ if [ -z "$PID" ]; then
+ /usr/sbin/chronyd $NTPD_ARGS &
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon chrony
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping chrony Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon chrony
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/clamav/rc.d b/src/clamav/rc.d
new file mode 100755
index 0000000..127c86c
--- /dev/null
+++ b/src/clamav/rc.d
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+[[ -f /etc/conf.d/clamav ]] && source /etc/conf.d/clamav
+
+PID_FC=$(pidof -o %PPID /usr/bin/freshclam)
+PID_CD=$(pidof -o %PPID /usr/sbin/clamd)
+
+case "$1" in
+ start)
+ if [[ $START_CLAMD = yes ]]; then
+ stat_busy "Starting ClamD"
+ [[ -z $PID_CD ]] && /usr/sbin/clamd
+ if [[ $? -gt 0 ]]; then
+ stat_fail
+ else
+ add_daemon clamav
+ stat_done
+ fi
+ fi
+ sleep 1
+ if [[ $START_FRESHCLAM = yes ]]; then
+ stat_busy "Starting FreshClam"
+ [[ -z $PID_FC ]] && /usr/bin/freshclam -p /run/clamav/freshclam.pid -d $FRESHCLAM_OPTS
+ if [[ $? -gt 0 ]]; then
+ stat_fail
+ else
+ add_daemon clamav
+ stat_done
+ fi
+ fi
+ ;;
+ stop)
+ if [[ $START_CLAMD = yes ]]; then
+ stat_busy "Stopping ClamD"
+ [[ -n $PID_CD ]] && kill $PID_CD &> /dev/null
+ if [[ $? -gt 0 ]]; then
+ stat_fail
+ else
+ rm_daemon clamav
+ stat_done
+ fi
+ fi
+
+ if [[ $START_FRESHCLAM = yes ]]; then
+ stat_busy "Stopping FreshClam"
+ [[ -n $PID_FC ]] && kill $PID_FC &> /dev/null
+ if [[ $? -gt 0 ]]; then
+ stat_fail
+ else
+ rm_daemon clamav
+ stat_done
+ fi
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/collectd/rc.d b/src/collectd/rc.d
new file mode 100755
index 0000000..442f232
--- /dev/null
+++ b/src/collectd/rc.d
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+name=collectd
+prog="/usr/sbin/collectdmon"
+
+PID=$(pidof -o %PPID $prog)
+
+case "$1" in
+start)
+ stat_busy "Starting $name daemon"
+ [[ -z "$PID" ]] && $prog \
+ && { add_daemon $name; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+stop)
+ stat_busy "Stopping $name daemon"
+ [[ -n "$PID" ]] && kill $PID &>/dev/null \
+ && { rm_daemon $name; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+reload)
+ stat_busy "Sending SIGHUP to $name daemon"
+ [[ -n "$PID" ]] && kill -HUP $PID &>/dev/null \
+ && { stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+*)
+ echo "usage: $0 {start|stop|restart|reload}"
+ exit 1
+ ;;
+esac
diff --git a/src/connman/connmand-daemon b/src/connman/connmand-daemon
new file mode 100755
index 0000000..aff1dde
--- /dev/null
+++ b/src/connman/connmand-daemon
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DESC="Connection Manager"
+NAME="connmand"
+ARGS=""
+DAEMON="/usr/sbin/$NAME"
+
+PID=`pidof -o %PPID ${DAEMON}`
+case "$1" in
+ start)
+ stat_busy "Starting ${DESC}"
+ if [ -z "$PID" ]; then
+ ${DAEMON} ${ARGS}
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ${NAME}
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ${DESC}"
+ [ ! -z "$PID" ] && killall ${DAEMON} &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ${NAME}
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/src/conntrack-tools/conntrackd.rc b/src/conntrack-tools/conntrackd.rc
new file mode 100755
index 0000000..4300a70
--- /dev/null
+++ b/src/conntrack-tools/conntrackd.rc
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+DAEMON=/usr/sbin/conntrackd
+PID=$(pidof -o %PPID $DAEMON)
+DAEMON_OPTIONS="-d $DAEMON_OPTIONS"
+
+case "$1" in
+ start)
+ stat_busy "Starting ${0##*/} daemon"
+ [[ ! $PID ]] && $DAEMON $DAEMON_OPTIONS && add_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ stop)
+ stat_busy "Stopping ${0##*/} daemon"
+ [[ $PID ]] && kill $PID &> /dev/null && rm_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit 0
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ ;;
+esac
+
+exit 1
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/couchdb/rc-script.patch b/src/couchdb/rc-script.patch
new file mode 100755
index 0000000..1dd723f
--- /dev/null
+++ b/src/couchdb/rc-script.patch
@@ -0,0 +1,57 @@
+--- couchdb 2011-12-27 01:21:59.000000000 +0400
++++ couchdb.my 2011-12-27 01:21:18.000000000 +0400
+@@ -1,6 +1,4 @@
+-#!/bin/bash
+-. /etc/rc.conf
+-. /etc/rc.d/functions
++#!/bin/sh -e
+
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ # use this file except in compliance with the License. You may obtain a copy of
+@@ -31,7 +29,7 @@
+ NAME=couchdb
+ SCRIPT_NAME=`basename $0`
+ COUCHDB=/usr/bin/couchdb
+-CONFIGURATION_FILE=/etc/conf.d/couchdb
++CONFIGURATION_FILE=/etc/default/couchdb
+ RUN_DIR=/var/run/couchdb
+ LSB_LIBRARY=/lib/lsb/init-functions
+
+@@ -44,14 +42,16 @@
+ fi
+
+ log_daemon_msg () {
+- stat_busy $@
++ # Dummy function to be replaced by LSB library.
++
++ echo $@
+ }
+
+ log_end_msg () {
++ # Dummy function to be replaced by LSB library.
++
+ if test "$1" != "0"; then
+- stat_fail
+- else
+- stat_done
++ echo "Error with $DESCRIPTION: $NAME"
+ fi
+ return $1
+ }
+@@ -66,7 +66,7 @@
+ command="$command $COUCHDB_OPTIONS"
+ fi
+ if test -n "$COUCHDB_USER"; then
+- if su $COUCHDB_USER -s /bin/bash -c "$command"; then
++ if su $COUCHDB_USER -c "$command"; then
+ return $SCRIPT_OK
+ else
+ return $SCRIPT_ERROR
+@@ -84,7 +84,6 @@
+ # Start Apache CouchDB as a background process.
+
+ mkdir -p "$RUN_DIR"
+- chown -R $COUCHDB_USER "$RUN_DIR"
+ command="$COUCHDB -b"
+ if test -n "$COUCHDB_STDOUT_FILE"; then
+ command="$command -o $COUCHDB_STDOUT_FILE"
diff --git a/src/cronie/rc.d b/src/cronie/rc.d
new file mode 100755
index 0000000..d065968
--- /dev/null
+++ b/src/cronie/rc.d
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+name=crond
+. /etc/conf.d/crond
+PID=$(pidof -o %PPID /usr/sbin/crond)
+
+case "$1" in
+start)
+ stat_busy "Starting $name daemon"
+ [[ -z "$PID" ]] && /usr/sbin/crond $CRONDARGS &>/dev/null \
+ && { add_daemon $name; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+stop)
+ stat_busy "Stopping $name daemon"
+ [[ -n "$PID" ]] && kill $PID &>/dev/null \
+ && { rm_daemon $name; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+reload)
+ stat_busy "Reloading $name daemon"
+ [[ -n "$PID" ]] && kill -HUP $PID &>/dev/null \
+ && { stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+*)
+ echo "usage: $0 {start|stop|restart|reload}"
+ ;;
+esac
+exit 0
diff --git a/src/cups/cups b/src/cups/cups
new file mode 100755
index 0000000..744c8e6
--- /dev/null
+++ b/src/cups/cups
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+daemon_name=cupsd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+#. /etc/conf.d/$daemon_name.conf
+
+get_pid() {
+ pidof -o %PPID $daemon_name
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name daemon"
+
+ PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
+ # RUN
+ $daemon_name
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo $(get_pid) > /var/run/$daemon_name.pid
+ add_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ PID=$(get_pid)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/$daemon_name.pid &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/src/cyrus-sasl/saslauthd b/src/cyrus-sasl/saslauthd
new file mode 100755
index 0000000..6afafae
--- /dev/null
+++ b/src/cyrus-sasl/saslauthd
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+# source application-specific settings
+[ -f /etc/conf.d/saslauthd ] && . /etc/conf.d/saslauthd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DAEMON_NAME="saslauthd"
+SASLAUTHD_BIN=/usr/sbin/saslauthd
+SASLAUTHD_RUN=/var/run/saslauthd
+SASLAUTHD_PID=$SASLAUTHD_RUN/saslauthd.pid
+
+case "$1" in
+ start)
+ stat_busy "Starting $DAEMON_NAME"
+ [ ! -d /var/run/saslauthd ] && install -d /var/run/saslauthd
+ if $SASLAUTHD_BIN $SASLAUTHD_OPTS >/dev/null; then
+ add_daemon $DAEMON_NAME
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $DAEMON_NAME"
+ [ -f $SASLAUTHD_PID ] && kill `cat $SASLAUTHD_PID` &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm_daemon $DAEMON_NAME
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
+# vim: ts=2 sw=2 et ft=sh
diff --git a/src/dante/sockd.rc b/src/dante/sockd.rc
new file mode 100755
index 0000000..00ea5a7
--- /dev/null
+++ b/src/dante/sockd.rc
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+daemon_name=sockd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/sockd.conf
+
+get_pid() {
+ cat /var/run/sockd.pid 2>/dev/null
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name daemon"
+
+ PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
+ # RUN
+ $daemon_name $SOCKD_OPTS 1>/dev/null 2>/dev/null
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo $(get_pid) > /var/run/$daemon_name.pid
+ add_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ PID=$(get_pid)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/$daemon_name.pid &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/src/darkstat/darkstat b/src/darkstat/darkstat
new file mode 100755
index 0000000..26df176
--- /dev/null
+++ b/src/darkstat/darkstat
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+daemon_bin="/usr/sbin/darkstat"
+daemon_name=$(basename $daemon_bin)
+daemon_chroot=/var/$daemon_name
+daemon_database="$daemon_name.dat"
+daemon_output="$daemon_chroot/$daemon_name.out"
+PIDF="$daemon_chroot/$daemon_name.pid"
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/$daemon_name.conf
+
+get_pid() {
+ pidof -o %PPID $daemon_name
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name daemon"
+
+ PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ [ -f $PIDF ] && rm -f $PIDF
+ # RUN
+ $daemon_bin --user "$daemon_name" --chroot "$daemon_chroot" \
+ --import "$daemon_database" \
+ --export "$daemon_database" \
+ --pidfile "$(basename $PIDF)" \
+ -i "$DARKSTAT_IFACE" \
+ $DARKSTAT_ARGS \
+ 2>&1 | tee "$daemon_output"
+ ret=$?
+ grep -q error "$daemon_output" 2>/dev/null
+ error_output=$?
+ rm -f "$daemon_output"
+ #
+ if [ $ret -gt 0 -o $error_output -eq 0 ] ; then
+ stat_fail
+ rm -f "$PIDF"
+ exit 1
+ else
+ add_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ PID=$(get_pid)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f $PIDF &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/src/dbmail/dbmail.rc.d b/src/dbmail/dbmail.rc.d
new file mode 100755
index 0000000..f849b16
--- /dev/null
+++ b/src/dbmail/dbmail.rc.d
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+[ -f /etc/conf.d/dbmail ] && . /etc/conf.d/dbmail
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ mkdir -p /var/run/dbmail
+ chown -R nobody:nobody /var/run/dbmail
+ for daemon in $DBMAIL_DAEMONS; do
+ stat_busy "Starting DbMail ${daemon}"
+ /usr/sbin/${daemon} -p /var/run/dbmail/${daemon}.pid
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ done
+ add_daemon dbmail
+ ;;
+ stop)
+ for daemon in $DBMAIL_DAEMONS; do
+ stat_busy "Stopping DbMail ${daemon}"
+ pid=$(cat /var/run/dbmail/${daemon}.pid 2>/dev/null)
+ kill $pid 2>/dev/null
+ while kill -0 "$pid" 2>/dev/null; do
+ sleep 0.2
+ done
+ stat_done
+ done
+ rm_daemon dbmail
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+
+exit 0
diff --git a/src/dbus-core/dbus b/src/dbus-core/dbus
new file mode 100755
index 0000000..bf532a2
--- /dev/null
+++ b/src/dbus-core/dbus
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case $1 in
+ start)
+ stat_busy "Starting D-BUS system messagebus"
+ if [[ ! -d /run/dbus ]] ; then
+ install -m755 -g 81 -o 81 -d /run/dbus
+ fi
+
+ if ! dbus-daemon --system; then
+ stat_fail
+ else
+ add_daemon dbus
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping D-BUS system messagebus"
+ if ! { [[ -f /run/dbus/pid ]] && kill $(</run/dbus/pid); }; then
+ stat_fail
+ else
+ rm -f /run/dbus/pid
+ rm_daemon dbus
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ reload)
+ stat_busy "Reloading D-BUS configuration"
+ if ! { [[ -f /run/dbus/pid ]] && dbus-send \
+ --system --type=method_call \
+ --dest=org.freedesktop.DBus \
+ / org.freedesktop.DBus.ReloadConfig; }; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|reload}"
+ ;;
+esac
+exit 0
diff --git a/src/ddclient/ddclient.rc b/src/ddclient/ddclient.rc
new file mode 100755
index 0000000..c9331d0
--- /dev/null
+++ b/src/ddclient/ddclient.rc
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+[ -f /etc/conf.d/ddclient ] && . /etc/conf.d/ddclient
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PIDFILE=/var/run/ddclient.pid
+ PID=`cat $PIDFILE 2>/dev/null`
+
+# Is ddclient running?
+
+case "$1" in
+ start)
+ stat_busy "Starting ddclient"
+ [ -z "$PID" ] && /usr/sbin/ddclient ${EXTRA_ARGS}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ddclient
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ddclient"
+ [ -n "$PID" ] && kill -15 $PID >/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ddclient
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/deluge/deluge-web b/src/deluge/deluge-web
new file mode 100755
index 0000000..d612c41
--- /dev/null
+++ b/src/deluge/deluge-web
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/deluged
+
+PIDFILE=/run/deluge/deluge-web.pid
+WEB_OPTIONS="-f $WEB_OPTIONS"
+
+[[ -f $PIDFILE ]] && PID=$(<$PIDFILE)
+[[ -z $PID ]] || kill -0 $PID || PID=
+
+case "$1" in
+ start)
+ stat_busy "Starting Deluge WebUI"
+ [[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluge-web $WEB_OPTIONS >/dev/null" deluge
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ sleep 1
+ echo $(pgrep -u deluge deluge-web) > $PIDFILE
+ add_daemon deluge-web
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Deluge WebUI"
+ [[ ! -z $PID ]] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm $PIDFILE
+ rm_daemon deluge-web
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/deluge/deluged b/src/deluge/deluged
new file mode 100755
index 0000000..dd426fc
--- /dev/null
+++ b/src/deluge/deluged
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/deluged
+
+PIDFILE=/run/deluge/deluged.pid
+OPTIONS="-P $PIDFILE $OPTIONS"
+
+[[ -f $PIDFILE ]] && PID=$(<$PIDFILE)
+[[ -z $PID ]] || kill -0 $PID &>/dev/null || PID=
+
+case "$1" in
+ start)
+ stat_busy "Starting Deluge Daemon"
+ [[ -z $PID ]] && su -l -s /bin/sh -c "/usr/bin/deluged $OPTIONS >/dev/null" deluge
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon deluged
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Deluge Daemon"
+ [[ ! -z $PID ]] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f $PIDFILE
+ rm_daemon deluged
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/dhcp/dhcp4 b/src/dhcp/dhcp4
new file mode 100755
index 0000000..8e1277a
--- /dev/null
+++ b/src/dhcp/dhcp4
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/dhcp
+
+PIDFILE="/var/run/dhcpd.pid"
+
+if [[ -f $PIDFILE ]]; then
+ read -r PID < "$PIDFILE"
+
+ # prevent stale pidfiles from hanging around
+ if [[ ! -d /proc/$PID ]]; then
+ echo 'pid not found. deleteing stale pidfile'
+ unset PID
+ rm -f "$PIDFILE"
+ fi
+fi
+
+case "$1" in
+ start)
+ stat_busy "Starting DHCPv4 Server"
+ if [[ $PID ]]; then
+ stat_fail
+ exit 1
+ fi
+ if /usr/sbin/dhcpd -4 -pf "$PIDFILE" $DHCP4_ARGS; then
+ add_daemon dhcp4
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping DHCPv4 Server"
+ if [[ ! $PID ]]; then
+ stat_fail
+ exit 1
+ fi
+ if { kill $PID && rm -f "$PIDFILE"; } &>/dev/null; then
+ rm_daemon dhcp4
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+
diff --git a/src/dhcp/dhcp6 b/src/dhcp/dhcp6
new file mode 100755
index 0000000..6b4b4d3
--- /dev/null
+++ b/src/dhcp/dhcp6
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/dhcp
+
+PIDFILE="/var/run/dhcp6.pid"
+
+if [[ -f $PIDFILE ]]; then
+ read -r PID < "$PIDFILE"
+
+ # prevent stale pidfiles from hanging around
+ if [[ ! -d /proc/$PID ]]; then
+ echo 'pid not found. deleteing stale pidfile'
+ unset PID
+ rm -f "$PIDFILE"
+ fi
+fi
+
+case "$1" in
+ start)
+ stat_busy "Starting DHCPv6 Server"
+ if [[ $PID ]]; then
+ stat_fail
+ exit 1
+ fi
+ if /usr/sbin/dhcpd -6 -pf "$PIDFILE" $DHCP6_ARGS; then
+ add_daemon dhcp6
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping DHCPv6 Server"
+ if [[ ! $PID ]]; then
+ stat_fail
+ exit 1
+ fi
+ if { kill $PID && rm -f "$PIDFILE"; } &>/dev/null; then
+ rm_daemon dhcp6
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+
diff --git a/src/dhcp/dhcpd b/src/dhcp/dhcpd
new file mode 100755
index 0000000..1fbb31e
--- /dev/null
+++ b/src/dhcp/dhcpd
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/dhcp
+
+PIDFILE="/var/run/dhcpd.pid"
+PID=`cat $PIDFILE 2>/dev/null`
+case "$1" in
+ start)
+ stat_busy "Starting DHCP Server"
+ if [ "$PID" = "" ]; then
+ /usr/sbin/dhcpd $DHCP_ARGS
+ fi
+ if [ "$PID" != "" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon dhcpd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping DHCP Server"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ rm -f $PIDFILE
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon dhcpd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/dictd/dictd b/src/dictd/dictd
new file mode 100755
index 0000000..4f435d6
--- /dev/null
+++ b/src/dictd/dictd
@@ -0,0 +1,92 @@
+#!/bin/bash
+
+. /etc/conf.d/dictd
+. /etc/rc.conf
+
+. /etc/rc.d/functions
+
+preconfiguration() {
+ stat_busy "Check dictd configuration"
+ if [ ! -e ${DICTD_CONF} ]; then
+ echo "No configuration"
+ stat_fail
+ exit 1
+ fi
+ stat_done
+
+ # The new way of doing this is to scan /usr/lib/dict and tweek the conf
+ stat_busy "Scanning for dictionaries..."
+ if [ ! -d "${DICTD_DICTDIR}" ]; then
+ echo "No dictionaries found"
+ stat_fail
+ exit 1
+ fi
+ stat_done
+ pushd ${DICTD_DICTDIR} >/dev/null
+ INDEXFILES=`ls *.index`
+ if [ -z "$INDEXFILES" ]; then
+ echo "No dictionaries found"
+ stat_fail
+ exit 1
+ fi
+
+ cat $DICTD_CONF | sed -e '/^#LASTLINE/,$d' > $DICTD_TMPCONF
+ echo "#LASTLINE" >> $DICTD_TMPCONF
+
+ CNT=0
+ for i in $INDEXFILES
+ do
+ DNAME=`echo $i | awk -F . '{print $1;}'`
+ #two possible names for a matching dictionary, check which is there.
+ if [ -f ${DNAME}.dict.dz ]; then
+ DICT=${DNAME}.dict.dz
+ elif [ -f ${DNAME}.dict ];then
+ DICT=${DNAME}.dict
+ else
+ echo "Index $i has no matching dictionaray..."
+ fi
+
+ #ok, go an index, and a dixtionary, append.
+ echo "database $DNAME { data \"${DICTD_DICTDIR}/${DICT}\"" >> $DICTD_TMPCONF
+ echo " index \"${DICTD_DICTDIR}/$i\" }" >> $DICTD_TMPCONF
+
+ CNT=`expr $CNT + 1`
+ done
+ popd >/dev/null
+ mv ${DICTD_TMPCONF} ${DICTD_CONF}
+ echo "$CNT dictionary indexes found."
+}
+
+PID=`pidof -o %PPID /usr/sbin/dictd`
+
+case "$1" in
+ start)
+ preconfiguration || exit 1
+ stat_busy "Start dictd daemon"
+ /usr/sbin/dictd $DICTD_ARGS -- $DICTD_EARGS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon dictd
+ stat_done
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stop dictd daemon"
+ kill $PID 2>/dev/null 1>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon dictd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/distcc/distccd b/src/distcc/distccd
new file mode 100755
index 0000000..4702d68
--- /dev/null
+++ b/src/distcc/distccd
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+[ -f /etc/conf.d/distccd ] && . /etc/conf.d/distccd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/distccd`
+case "$1" in
+ start)
+ stat_busy "Starting distcc Daemon"
+ [ -z "$PID" ] && /usr/bin/distccd --daemon ${DISTCC_ARGS}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon distccd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping distcc Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon distccd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/dkfilter/dkfilter-rc b/src/dkfilter/dkfilter-rc
new file mode 100755
index 0000000..5c6ec7b
--- /dev/null
+++ b/src/dkfilter/dkfilter-rc
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+. /etc/conf.d/dkfilter
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DKFILTER_IN_ARGS="--user=$DKFILTER_USER --group=$DKFILTER_GROUP --hostname=$DKFILTER_HOSTNAME 127.0.0.1:10025 127.0.0.1:10026"
+DKFILTER_OUT_ARGS="--user=$DKFILTER_USER --group=$DKFILTER_GROUP --keyfile=$DKFILTER_PRIVATE_KEY --selector=$DKFILTER_SELECTOR --domain=$DKFILTER_DOMAIN --method=nofws --headers 127.0.0.1:10027 127.0.0.1:10028"
+
+DKFILTER_IN_BIN="/usr/bin/dkfilter.in"
+DKFILTER_OUT_BIN="/usr/bin/dkfilter.out"
+PIDDKFILTER_IN="/var/run/dkfilter.in"
+PIDDKFILTER_OUT="/var/run/dkfilter.out"
+
+get_pid_in() {
+ ps fax | grep dkfilter.in | grep perl | awk -- "{print \$1}"
+}
+
+get_pid_out() {
+ ps fax | grep dkfilter.out | grep perl | awk -- "{print \$1}"
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting inbound DomainKeys-filter (dkfilter.in)..."
+ $DKFILTER_IN_BIN $DKFILTER_IN_ARGS 1>>/var/log/dkfilter.in 2>>/var/log/dkfilter.in &
+ get_pid_in dkfilter.in >$PIDDKFILTER_IN
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ stat_done
+ else
+ stat_fail
+ exit $RETVAL
+ fi
+
+ stat_busy "Starting outbound DomainKeys-filter (dkfilter.out)..."
+ $DKFILTER_OUT_BIN $DKFILTER_OUT_ARGS 1>>/var/log/dkfilter.out 2>>/var/log/dkfilter.out &
+ get_pid_out dkfilter.out >$PIDDKFILTER_OUT
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ stat_done
+ else
+ stat_fail
+ exit $RETVAL
+ fi
+ ;;
+
+ stop)
+ stat_busy "Shutting down inbound DomainKeys-filter (dkfilter.in)..."
+ kill `get_pid_in`
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ stat_done
+ else
+ stat_fail
+ exit $RETVAL
+ fi
+ stat_busy "Shutting down outbound DomainKeys-filter (dkfilter.out)..."
+ kill `get_pid_out`
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ stat_done
+ else
+ stat_fail
+ exit $RETVAL
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+ ;;
+esac
diff --git a/src/dkms/dkms.rc b/src/dkms/dkms.rc
new file mode 100755
index 0000000..0737274
--- /dev/null
+++ b/src/dkms/dkms.rc
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy 'Starting Dynamic Kernel Module System'
+ if /usr/lib/systemd/scripts/dkms start >/dev/null; then
+ add_daemon ${0##*/}
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy 'Stopping Dynamic Kernel Module System'
+ if /usr/lib/systemd/scripts/dkms stop >/dev/null; then
+ rm_daemon ${0##*/}
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop}" >&2
+ exit 1
+ ;;
+esac
+
+:
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/dnsmasq/rc.dnsmasq b/src/dnsmasq/rc.dnsmasq
new file mode 100755
index 0000000..4030c28
--- /dev/null
+++ b/src/dnsmasq/rc.dnsmasq
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/dnsmasq
+
+checkconfig() {
+ local testout
+
+ if ! testout=$(/usr/bin/dnsmasq --test 2>&1); then
+ echo "$testout"
+ return 1
+ fi
+
+ return 0
+}
+
+pidfile=/run/dnsmasq.pid
+if [[ -r $pidfile ]]; then
+ read -r PID < "$pidfile"
+ if [[ ! -d /proc/$PID ]]; then
+ # stale pidfile
+ unset PID
+ rm -f "$pidfile"
+ fi
+fi
+
+case $1 in
+ start)
+ stat_busy "Starting DNS/DHCP daemon"
+ if [[ -z $PID ]] && checkconfig &&
+ /usr/bin/dnsmasq "--user=${DNSMASQ_USER:-nobody}" \
+ "--pid-file=$pidfile" \
+ "${DNSMASQ_OPTS[@]}"; then
+ add_daemon dnsmasq
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping DNS/DHCP daemon"
+ if [[ $PID ]] && kill "$PID" &> /dev/null; then
+ # dnsmasq doesn't clean up after itself
+ rm -f "$pidfile"
+ rm_daemon dnsmasq
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ checkconfig)
+ # diagnostics will be printed, with zero/non-zero exit
+ /usr/bin/dnsmasq --test
+ ;;
+ *)
+ echo "usage: $0 <start|stop|restart|checkconfig>"
+esac
+
diff --git a/src/dovecot/dovecot.sh b/src/dovecot/dovecot.sh
new file mode 100755
index 0000000..e8966bd
--- /dev/null
+++ b/src/dovecot/dovecot.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+daemon_name=dovecot
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+#. /etc/conf.d/$daemon_name.conf
+
+get_pid() {
+ pidof -o %PPID $daemon_name
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name daemon"
+
+ PID=$(get_pid)
+ if [[ -z $PID ]]; then
+ [[ -f /var/run/$daemon_name.pid ]] &&
+ rm -f /var/run/$daemon_name.pid
+ # RUN
+ $daemon_name
+ #
+ if [[ $? -gt 0 ]]; then
+ stat_fail
+ exit 1
+ else
+ echo $(get_pid) > /var/run/$daemon_name.pid
+ add_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ PID=$(get_pid)
+ # KILL
+ [[ -n $PID ]] && kill $PID &> /dev/null
+ #
+ if [[ $? -gt 0 ]]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/$daemon_name.pid &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/src/drbd/drbd.rc b/src/drbd/drbd.rc
new file mode 100755
index 0000000..b8b196e
--- /dev/null
+++ b/src/drbd/drbd.rc
@@ -0,0 +1,58 @@
+#!/bin/bash
+# Written by S├ębastien Luttringer
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DRBDADM='/usr/sbin/drbdadm'
+PROC_DRBD='/proc/drbd'
+
+check_config() {
+ # check if module is loaded
+ if [[ ! -e $PROC_DRBD ]]; then
+ echo "Missing $PROC_DRBD. Try to load drbd module!"
+ stat_fail
+ exit 1
+ fi
+ # check if config is correct
+ if ! $DRBDADM dump &>/dev/null; then
+ echo 'Invalid configuration'
+ stat_fail
+ exit 1
+ fi
+}
+
+case "$1" in
+ start)
+ stat_busy 'Starting DRBD resources'
+ # check module and config
+ check_config
+ # load config
+ $DRBDADM adjust all 2>/dev/null || { stat_fail; exit 1; }
+ # user interruptible version of wait-connect all
+ $DRBDADM wait-con-int 2>/dev/null || { stat_fail; exit 1; }
+ # become primary if configured
+ $DRBDADM sh-b-pri all 2>/dev/nul l|| { stat_fail; exit 1; }
+ add_daemon drbd
+ stat_done
+ ;;
+ stop)
+ stat_busy 'Stopping DRBD resources'
+ # check module and config
+ check_config
+ # disconnect and detach all resources
+ $DRBDADM down all 2>/dev/null || { stat_fail; exit 1; }
+ rm_daemon drbd
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+
+exit 0
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/dspam/dspam b/src/dspam/dspam
new file mode 100755
index 0000000..be533ba
--- /dev/null
+++ b/src/dspam/dspam
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/dspam`
+case "$1" in
+ start)
+ stat_busy "Starting DSPAM Daemon"
+ [ -d /var/run/dspam ] || mkdir -p /var/run/dspam
+ [ -z "$PID" ] && /usr/bin/dspam --daemon &> /dev/null &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon dspam
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping DSPAM Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon dspam
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/ebtables/ebtables.rc b/src/ebtables/ebtables.rc
new file mode 100755
index 0000000..a845449
--- /dev/null
+++ b/src/ebtables/ebtables.rc
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+case "$1" in
+ start)
+ stat_busy 'Loading ebtables rules'
+ ebtables-restore < "$CONFIG_FILE" &&
+ add_daemon ${0##*/} && stat_done || stat_die
+ ;;
+ stop)
+ [[ $SAVE_ON_STOP =~ [yY][eE][sS] ]] && $0 save
+ status 'Clearing ebtables rules' ebtables -F && rm_daemon ${0##*/} || exit 1
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ save)
+ stat_busy 'Saving ebtables rules'
+ ebtables-save > "$CONFIG_FILE" && stat_done || stat_die
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart|save}" >&2
+ exit 1
+ ;;
+esac
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/ejabberd/ejabberd b/src/ejabberd/ejabberd
new file mode 100755
index 0000000..c73be81
--- /dev/null
+++ b/src/ejabberd/ejabberd
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+cd /var/log/ejabberd/
+
+get_pid() {
+ pidof epmd >/dev/null || { echo '' ; return 0; }
+ # get port from 'epmd -names', then get pid from 'ss -tlnp'
+ PORT=`epmd -names | grep ejabberd | cut -f5 -d\ `
+ [ -z "$PORT" ] && { echo '' ; return 0; }
+ PID=`ss -tlnp | grep $PORT | grep -oE '[[:digit:]]+,' | cut -d, -f1`
+ [ -z "$PID" ] && { echo '' ; return 0; }
+ echo ${PID%/}
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting ejabber daemon"
+
+ [ -d /var/lock/ejabberdctl ] || mkdir -p /var/lock/ejabberdctl
+ [ -f /var/run/ejabber.pid ] && rm -f /var/run/ejabber.pid
+ PID=`get_pid`
+ if [ -z "$PID" ]; then
+ su ejabberd -s /bin/bash - -c 'erl -pa /usr/lib/ejabberd/ebin -sname ejabberd -s ejabberd -ejabberd config \"/etc/ejabberd/ejabberd.cfg\" log_path \"/var/log/ejabberd/ejabberd.log\" -sasl sasl_error_logger \{file,\"/var/log/ejabberd/sasl.log\"\} -mnesia dir \"/var/lib/ejabberd\" -detached -kernel inetrc \"/etc/ejabberd/inetrc\"'
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo `get_pid` > /var/run/ejabberd.pid
+ add_daemon ejabberd
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping ejabber daemon"
+ PID=`get_pid`
+ [ ! -z "$PID" ] && su ejabberd -s /bin/bash - -c "kill $PID" &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/ejabberd.pid &> /dev/null
+ rm_daemon ejabberd
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/espeakup/espeakup b/src/espeakup/espeakup
new file mode 100755
index 0000000..94a7170
--- /dev/null
+++ b/src/espeakup/espeakup
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/conf.d/espeakup
+. /etc/rc.d/functions
+
+PID=`pidof espeakup`
+PIDFILE=/var/run/espeakup.pid
+case "$1" in
+ start)
+ stat_busy "Starting Espeakup"
+ if [ -z "$PID" ]; then
+ if [ -f $PIDFILE ]; then
+ rm $PIDFILE
+ fi
+ /usr/bin/espeakup $ESPEAKUP_ARGS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon espeakup
+ stat_done
+ fi
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Espeakup"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon espeakup
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/exabgp/exabgp.rc b/src/exabgp/exabgp.rc
new file mode 100755
index 0000000..0cf5bee
--- /dev/null
+++ b/src/exabgp/exabgp.rc
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+DAEMON=/usr/bin/${0##*/}
+DAEMON_USER=nobody
+DAEMON_OPTS=/etc/exabgp.conf
+PIDFILE=${PIDFILE:-/run/${0##*/}.pid}
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+# check pid file
+[[ -r "$PIDFILE" ]] &&
+ read PID < "$PIDFILE" && [[ -n $PID ]] && kill -0 $PID || unset PID
+
+case "$1" in
+ start)
+ stat_busy "Starting ${0##*/} daemon"
+ [[ ! $PID ]] && env exabgp.daemon.daemonize=true \
+ exabgp.log.destination=syslog \
+ exabgp.daemon.user="$DAEMON_USER" \
+ exabgp.daemon.pid="$PIDFILE" "$DAEMON" $DAEMON_OPTS &&
+ add_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ stop)
+ stat_busy "Stopping ${0##*/} daemon"
+ [[ $PID ]] && kill $PID &> /dev/null && rm_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit 0
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ ;;
+esac
+
+exit 1
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/exim/exim b/src/exim/exim
new file mode 100755
index 0000000..8e9640b
--- /dev/null
+++ b/src/exim/exim
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+# source application-specific settings
+[ -f /etc/conf.d/exim ] && . /etc/conf.d/exim
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/exim`
+
+case "$1" in
+ start)
+ stat_busy "Starting Exim"
+ [ -z "$PID" ] && /usr/sbin/exim $EXIM_ARGS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon exim
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Exim"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm /var/run/exim.pid
+ rm_daemon exim
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/fail2ban/rc.d b/src/fail2ban/rc.d
new file mode 100755
index 0000000..5cce6da
--- /dev/null
+++ b/src/fail2ban/rc.d
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+FAIL2BAN="/usr/bin/fail2ban-client"
+
+case "$1" in
+ start)
+ stat_busy "Starting fail2ban"
+
+ [ -d /var/run/fail2ban ] || mkdir -p /var/run/fail2ban
+ [ -f /var/run/fail2ban/fail2ban.pid ] && rm -f /var/run/fail2ban/fail2ban.pid
+ $FAIL2BAN start >/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon fail2ban
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping fail2ban"
+ if [ "`$FAIL2BAN stop`" == "Shutdown successful" ]; then
+ rm -f /var/run/fail2ban/fail2ban.pid &> /dev/null
+ rm_daemon fail2ban
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/fcgiwrap/fcgiwrap.rc.d b/src/fcgiwrap/fcgiwrap.rc.d
new file mode 100755
index 0000000..42787d1
--- /dev/null
+++ b/src/fcgiwrap/fcgiwrap.rc.d
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DAEMON=fcgiwrap
+
+# source application-specific settings
+[ -f /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON
+
+# set defaults if settings are missing
+[ -z "$SPAWNER" ] && SPAWNER='/usr/bin/spawn-fcgi'
+[ -z "$SPAWNER_ARGS" ] && SPAWNER_ARGS='-a 127.0.0.1 -p 9001 -u http -g http -- /usr/sbin/fcgiwrap'
+
+get_pid() {
+ pidof -o %PPID $DAEMON
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting $DAEMON daemon"
+
+ PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$DAEMON.pid ] && rm -f /var/run/$DAEMON.pid
+ # RUN
+ $SPAWNER $SPAWNER_ARGS &> /dev/null
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo $(get_pid) > /var/run/$DAEMON.pid
+ add_daemon $DAEMON
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $DAEMON daemon"
+ PID=$(get_pid)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/$DAEMON.pid &> /dev/null
+ rm_daemon $DAEMON
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $DAEMON status";
+ ck_status $DAEMON
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/src/fcron/fcron.rc b/src/fcron/fcron.rc
new file mode 100755
index 0000000..880439a
--- /dev/null
+++ b/src/fcron/fcron.rc
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/fcron`
+case "$1" in
+ start)
+ stat_busy "Starting Fcron Daemon"
+ [ -z "$PID" ] && /usr/sbin/fcron -b
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon fcron
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Fcron Daemon"
+ [ -n "$PID" ] && kill $PID >/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon fcron
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/ferm/ferm.rc b/src/ferm/ferm.rc
new file mode 100755
index 0000000..0325c4d
--- /dev/null
+++ b/src/ferm/ferm.rc
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+case "$1" in
+ start)
+ status 'Loading FERM rules' ferm "$CONFIG_FILE" &&
+ add_daemon ${0##*/} || exit 1
+ ;;
+ stop)
+ status 'Clearing FERM rules' ferm -F "$CONFIG_FILE" &&
+ rm_daemon ${0##*/} || exit 1
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ exit 1
+ ;;
+esac
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/fetchmail/fetchmail.rc b/src/fetchmail/fetchmail.rc
new file mode 100755
index 0000000..4d8b98d
--- /dev/null
+++ b/src/fetchmail/fetchmail.rc
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/fetchmail
+
+PID=`pidof -o %PPID /usr/bin/fetchmail`
+case "$1" in
+ start)
+ stat_busy "Starting fetchmail"
+ [ -z "$PID" ] &&
+ su -c "/usr/bin/fetchmail -d $INTERVAL -f $CONFIG" -s /bin/sh fetchmail
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon fetchmail
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping fetchmail"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon fetchmail
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/fluidsynth/fluidsynth.rc b/src/fluidsynth/fluidsynth.rc
new file mode 100755
index 0000000..ca1e8fa
--- /dev/null
+++ b/src/fluidsynth/fluidsynth.rc
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+[ -f /etc/conf.d/fluidsynth ] && . /etc/conf.d/fluidsynth
+
+PID=`pidof -o %PPID /usr/bin/fluidsynth`
+case "$1" in
+ start)
+ stat_busy "Starting Fluidsynth soundfont synthesizer"
+ [ -z "$PID" ] && /usr/bin/fluidsynth -is $FSYNTH_OPTS $FSYNTH_SOUNDFONT > /dev/null 2>&1 &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo $PID > /var/run/fluidsynth.pid
+ add_daemon fluidsynth
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Fluidsynth soundfont synthesizer"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm /var/run/fluidsynth.pid
+ rm_daemon fluidsynth
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/freeradius/radiusd b/src/freeradius/radiusd
new file mode 100755
index 0000000..bf872b6
--- /dev/null
+++ b/src/freeradius/radiusd
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/radiusd`
+case "$1" in
+ start)
+ stat_busy "Starting radiusd Server"
+
+ [ -d /var/run/radiusd ] || mkdir -p /var/run/radiusd
+ [ -f /var/run/radiusd/radiusd.pid ] || touch /var/run/radiusd/radiusd.pid
+ chown -R radiusd.radiusd /var/run/radiusd
+
+ [ -z "$PID" ] && /usr/sbin/radiusd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo $PID > /var/run/radiusd.pid
+ add_daemon radiusd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping radiusd Server"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm /var/run/radiusd.pid
+ rm_daemon radiusd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/fssos-nsvs/nsvsd b/src/fssos-nsvs/nsvsd
new file mode 100755
index 0000000..f9b4845
--- /dev/null
+++ b/src/fssos-nsvs/nsvsd
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting nsvsd"
+ /usr/sbin/nsvsd -f /etc/nsvsd.conf
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon nsvsd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping nsvsd"
+ kill `cat /var/run/nsvsd.pid` &>/dev/null
+ rm -f /var/run/nsvsd.pid
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon nsvsd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/fuse/fuse.rc.d b/src/fuse/fuse.rc.d
new file mode 100755
index 0000000..768da5b
--- /dev/null
+++ b/src/fuse/fuse.rc.d
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# fuse Init script for Filesystem in Userspace
+# Based on the script by Miklos Szeredi <miklos@szeredi.hu>
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+FUSECTL=/sys/fs/fuse/connections
+
+case "$1" in
+ start)
+ stat_busy "Starting fuse"
+ if ! grep -qw fuse /proc/filesystems; then
+ modprobe fuse >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ fi
+ fi
+ if grep -qw fusectl /proc/filesystems && ! grep -qw $FUSECTL /proc/mounts; then
+ mount -t fusectl none $FUSECTL >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ fi
+ fi
+ add_daemon fuse
+ stat_done
+ ;;
+ stop)
+ stat_busy "Stopping fuse"
+ umount $FUSECTL >/dev/null 2>&1
+ rmmod fuse >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon fuse
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/git/git-daemon b/src/git/git-daemon
new file mode 100755
index 0000000..21ba73e
--- /dev/null
+++ b/src/git/git-daemon
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+daemon_bin="/usr/lib/git-core/git-daemon"
+daemon_name=$(basename $daemon_bin)
+PIDF="/var/run/$daemon_name.pid"
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/$daemon_name.conf
+
+get_pid() {
+ pidof -o %PPID $daemon_name
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name daemon"
+
+ PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ [ -f $PIDF ] && rm -f $PIDF
+ # RUN
+ $daemon_bin --pid-file=$PIDF $GIT_DAEMON_ARGS
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo $(get_pid) > $PIDF
+ add_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ PID=$(get_pid)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f $PIDF &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/src/gkrellm/gkrellmd b/src/gkrellm/gkrellmd
new file mode 100755
index 0000000..1f255e7
--- /dev/null
+++ b/src/gkrellm/gkrellmd
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# source application-specific settings
+GKRELLMD_ARGS='-d'
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=$(pidof -o %PPID /usr/bin/gkrellmd)
+case "$1" in
+ start)
+ stat_busy "Starting GKrellM Daemon"
+ [ -z "$PID" ] && /usr/bin/gkrellmd ${GKRELLMD_ARGS}
+ PID=$(pidof -o %PPID /usr/bin/gkrellmd)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ add_daemon gkrellmd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping GKrellM Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon gkrellmd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/glibc/nscd.rcd b/src/glibc/nscd.rcd
new file mode 100755
index 0000000..4b48ab0
--- /dev/null
+++ b/src/glibc/nscd.rcd
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+daemon_name="nscd"
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+
+get_pid() {
+ pidof -o %PPID $daemon_name
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name daemon"
+ PID=$(get_pid)
+ if [[ -z $PID ]]; then
+ rm -f /run/$daemon_name.pid
+ mkdir -p /run/nscd /var/db/nscd
+ rm -f /run/nscd/* /var/db/nscd/*
+ $daemon_name
+ if (( $? > 0 )); then
+ stat_fail
+ exit 1
+ else
+ echo $(get_pid) > /var/run/$daemon_name.pid
+ add_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ PID=$(get_pid)
+ [[ -n $PID ]] && nscd --shutdown &> /dev/null
+ if (( $? > 0 )); then
+ stat_fail
+ exit 1
+ else
+ rm -f /run/$daemon_name.pid &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/src/glusterfs/glusterd.rc b/src/glusterfs/glusterd.rc
new file mode 100755
index 0000000..61cc264
--- /dev/null
+++ b/src/glusterfs/glusterd.rc
@@ -0,0 +1,39 @@
+#!/bin/sh
+# Thanks to igor
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID="/var/run/glusterd.pid"
+
+case "$1" in
+ start)
+ stat_busy "Starting glusterd"
+ /usr/sbin/glusterd -p $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon glusterd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping glusterd"
+ kill -QUIT `cat "$PID"` &>/dev/null
+ if [ $? -ne 0 ]; then
+ stat_fail
+ else
+ rm_daemon glusterd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+
+exit 0
diff --git a/src/gnump3d/gnump3d b/src/gnump3d/gnump3d
new file mode 100755
index 0000000..f6a3304
--- /dev/null
+++ b/src/gnump3d/gnump3d
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_gnump3d_pid() {
+ ps -C gnump3d -o pid= -o args= | grep /usr/bin/gnump3d | awk '{print $1}' | tr '\n' ' '
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting GNUMP3d Streaming Server"
+ [ "x$(get_gnump3d_pid)" == "x" ] && /usr/bin/gnump3d --quiet --background &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon gnump3d
+ stat_done
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping GNUMP3d Streaming Server"
+ for PID in $(get_gnump3d_pid) ; do
+ kill $PID 2> /dev/null
+ done
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon gnump3d
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+
+exit 0
+
diff --git a/src/gnunet/gnunet.rc b/src/gnunet/gnunet.rc
new file mode 100755
index 0000000..30ac4d2
--- /dev/null
+++ b/src/gnunet/gnunet.rc
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+GNUNETD_USER=nobody
+
+. /etc/conf.d/gnunetd
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=$(pidof -o %PPID /usr/bin/gnunet-arm)
+case "$1" in
+ start)
+ stat_busy "Starting gnunet services"
+ [ -z "$PID" ] && su -c '/usr/bin/gnunet-arm -s -c /etc/gnunetd.conf' - $GNUNETD_USER 1>/dev/null 2>/dev/null &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon gnunetd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping gnunet services"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon gnunetd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/src/gpm/gpm b/src/gpm/gpm
new file mode 100755
index 0000000..7b5213d
--- /dev/null
+++ b/src/gpm/gpm
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# source application-specific settings
+GPM_ARGS=
+[ -f /etc/conf.d/gpm ] && . /etc/conf.d/gpm
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=$(pidof -o %PPID /usr/sbin/gpm)
+case "$1" in
+ start)
+ stat_busy "Starting GPM Daemon"
+ [ -z "$PID" ] && /usr/sbin/gpm ${GPM_ARGS}
+ PID=$(pidof -o %PPID /usr/sbin/gpm)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ add_daemon gpm
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping GPM Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon gpm
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/gpsd/gpsd b/src/gpsd/gpsd
new file mode 100755
index 0000000..2ca7efe
--- /dev/null
+++ b/src/gpsd/gpsd
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+[ -f /etc/conf.d/gpsd ] && . /etc/conf.d/gpsd
+
+NAME=gpsd
+DAEMON=/usr/sbin/gpsd
+PIDFILE=/run/gpsd.pid
+PID=$(cat $PIDFILE 2>/dev/null)
+
+case "$1" in
+ start)
+ stat_busy "Starting gpsd"
+ [ -z "$PID" ] && "$DAEMON" -P $PIDFILE -F /run/gpsd.sock ${GPSD_OPTIONS} ${DEVICES}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon $NAME
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping $NAME"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f $PIDFILE &>/dev/null
+ rm_daemon $NAME
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/haveged/rc.d b/src/haveged/rc.d
new file mode 100755
index 0000000..c0e13b4
--- /dev/null
+++ b/src/haveged/rc.d
@@ -0,0 +1,44 @@
+#!/bin/bash
+##
+# chkconfig: 2345 75 25
+# description: havege entropy daemon
+#
+# source function library
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+RETVAL=0
+prog="haveged"
+
+case "$1" in
+start)
+ stat_busy $"Starting $prog"
+ /usr/sbin/$prog -w 1024 -v 1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon $prog
+ stat_done
+ fi
+ ;;
+
+stop)
+ stat_busy $"Stopping $prog"
+ kill `cat /var/run/$prog.pid`
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon $prog
+ stat_done
+ rm -f /var/lock/$prog
+ fi
+ ;;
+
+restart)
+ $0 stop
+ $0 start
+ ;;
+
+*)
+ echo "usage: $prog [start|stop|restart]"
+esac
diff --git a/src/hdapsd/hdapsd.rc.d b/src/hdapsd/hdapsd.rc.d
new file mode 100755
index 0000000..f4e8a6b
--- /dev/null
+++ b/src/hdapsd/hdapsd.rc.d
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+[ -f /etc/conf.d/hdapsd ] && . /etc/conf.d/hdapsd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PIDFILE=/var/run/hdapsd.pid
+PID=`cat ${PIDFILE} 2> /dev/null`
+
+case "$1" in
+ start)
+ stat_busy "Starting hdapsd"
+
+ ## The daemon will try to autoload the kernel module
+ #if [ ! -d /sys/devices/platform/hdaps ]; then
+ # stat_fail
+ # echo "You need to load the hdaps kernel module."
+ # exit 1
+ #fi
+
+ ## Set up options to the hdapsd daemon
+ HDAPSD_OPTS="-bp"
+ if [ -z "${DEVICE}" ]; then
+ HDAPSD_OPTS="${HDAPSD_OPTS} -d sda"
+ else
+ for i in ${DEVICE[@]}; do
+ HDAPSD_OPTS="${HDAPSD_OPTS} -d ${i}"
+ done
+ fi
+ [ ! -z "${SENSITIVITY}" ] && HDAPSD_OPTS="${HDAPSD_OPTS} -s ${SENSITIVITY}"
+ [ "${ADAPTIVE}" = "yes" ] && HDAPSD_OPTS="${HDAPSD_OPTS} -a"
+ [ "${SYSLOG}" = "yes" ] && HDAPSD_OPTS="${HDAPSD_OPTS} -l"
+ [ "${FORCE}" = "yes" ] && HDAPSD_OPTS="${HDAPSD_OPTS} -f"
+ [ -z "${PID}" ] && /usr/sbin/hdapsd ${HDAPSD_OPTS}
+ if [ ${?} -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon hdapsd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping hdapsd"
+ [ ! -z "${PID}" ] && kill $PID &> /dev/null
+ if [ ${?} -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon hdapsd
+ stat_done
+ fi
+ ;;
+ restart)
+ ${0} stop
+ sleep 1
+ ${0} start
+ ;;
+ *)
+ echo "usage: ${0} {start|stop|restart}"
+esac
diff --git a/src/hddtemp/rc.d b/src/hddtemp/rc.d
new file mode 100755
index 0000000..62f0908
--- /dev/null
+++ b/src/hddtemp/rc.d
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PARAMS=
+DRIVES=
+[ -f /etc/conf.d/hddtemp ] && . /etc/conf.d/hddtemp
+PID=$(pidof -o %PPID /usr/sbin/hddtemp)
+case "$1" in
+ start)
+ stat_busy "Starting HDDTemp"
+ [ -z "$PID" ] && /usr/sbin/hddtemp -d $PARAMS $DRIVES
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon hddtemp
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping HDDTemp"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon hddtemp
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/hostapd/hostapd b/src/hostapd/hostapd
new file mode 100755
index 0000000..b4709d7
--- /dev/null
+++ b/src/hostapd/hostapd
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/hostapd
+
+case "$1" in
+ start)
+ stat_busy "Starting hostapd"
+ /usr/bin/hostapd -B -P ${HOSTAPD_PID} ${HOSTAPD_CONF} &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ add_daemon hostapd
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping hostapd"
+ [ -f ${HOSTAPD_PID} ] && kill `cat ${HOSTAPD_PID}` &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ rm_daemon hostapd
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/hylafax/hylafax b/src/hylafax/hylafax
new file mode 100755
index 0000000..9f949c2
--- /dev/null
+++ b/src/hylafax/hylafax
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DAEMON_NAME="hylafax"
+FAXQ_BIN=/usr/sbin/faxq
+FAXQ_PID=`pidof -o %PPID $FAXQ_BIN`
+HFAXD_BIN=/usr/lib/fax/hfaxd
+HFAXD_PID=`pidof -o %PPID $HFAXD_BIN`
+HFAXD_OPTS="-i hylafax"
+FAXQUIT_BIN=/usr/sbin/faxquit
+
+. /var/spool/hylafax/etc/setup.cache
+
+case "$1" in
+ start)
+ stat_busy "Starting $DAEMON_NAME"
+ [ -z "$FAXQ_PID" ] && $FAXQ_BIN
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo `pidof -o %PPID $FAXQ_BIN` > /var/run/faxq.pid
+ fi
+ [ -z "$HFAXD_PID" ] && $HFAXD_BIN $HFAXD_OPTS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo `pidof -o %PPID $HFAXD_BIN` > /var/run/hfaxd.pid
+ fi
+ add_daemon $DAEMON_NAME
+ stat_done
+ ;;
+
+ stop)
+ stat_busy "Stopping $DAEMON_NAME"
+ $FAXQUIT_BIN >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ [ ! -z "$FAXQ_PID" ] && kill $FAXQ_PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm /var/run/faxq.pid &> /dev/null
+ fi
+ else
+ rm /var/run/faxq.pid &> /dev/null
+ fi
+ [ ! -z "$HFAXD_PID" ] && kill $HFAXD_PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm /var/run/hfaxd.pid &> /dev/null
+ fi
+ rm_daemon $DAEMON_NAME
+ stat_done
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/i8kmon/i8kmon.daemon b/src/i8kmon/i8kmon.daemon
new file mode 100755
index 0000000..df36cc4
--- /dev/null
+++ b/src/i8kmon/i8kmon.daemon
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+[ -f /etc/conf.d/i8kmon ] && . /etc/conf.d/i8kmon
+
+PID=$(fuser /proc/i8k 2>/dev/null)
+case "$1" in
+ start)
+ stat_busy "Starting i8kmon Daemon"
+ if [ -z "$PID" ]; then
+ /usr/bin/i8kmon -d $I8KMON_ARGS &
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon i8kmon
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping i8kmon Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon i8kmon
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/icecast/icecastd b/src/icecast/icecastd
new file mode 100755
index 0000000..e6c91b0
--- /dev/null
+++ b/src/icecast/icecastd
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+timeo=30
+
+getPID() {
+ pgrep -u nobody icecast 2>/dev/null
+}
+
+case $1 in
+ start)
+ stat_busy "Starting Icecast Server"
+ if getPID >/dev/null; then
+ # already running
+ stat_fail
+ exit 1
+ else
+ /usr/bin/icecast -b -c /etc/icecast.xml &>/dev/null
+ while (( timeo > 0 )); do
+ if getPID >/dev/null; then
+ add_daemon icecast
+ stat_done
+ exit 0
+ fi
+ sleep 1
+ (( timeo-- ))
+ done
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping Icecast Server"
+ if ! getPID >/dev/null; then
+ # not running
+ stat_done
+ exit 1
+ fi
+ if ! kill $(getPID) &> /dev/null; then
+ stat_fail
+ exit 1
+ fi
+ while (( timeo > 0 )); do
+ if getPID >/dev/null; then
+ rm_daemon icecast
+ stat_done
+ exit 0
+ fi
+ sleep 1
+ (( timeo-- ))
+ done
+ stat_fail
+ exit 1
+ ;;
+
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/ifplugd/ifplugd b/src/ifplugd/ifplugd
new file mode 100755
index 0000000..354238f
--- /dev/null
+++ b/src/ifplugd/ifplugd
@@ -0,0 +1,105 @@
+#!/bin/bash
+#
+# ifplugd daemon script for Arch Linux
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+shopt -s extglob
+
+# env vars
+daemonname=ifplugd
+cfg=/etc/ifplugd/ifplugd.conf
+PID=$(pidof -o %PPID ifplugd)
+
+# source configuration file
+[[ -r $cfg ]] && . "$cfg"
+
+# discover interfaces to monitor
+net_ifs=($INTERFACES)
+
+case $1 in
+ start)
+ stat_busy "Starting $daemonname: ${net_ifs[*]}"
+
+ for nic in "${net_ifs[@]}"; do
+ # only start if a PID doesn't already exist
+ if [[ ! -f /var/run/ifplugd.$nic.pid ]]; then
+ /usr/bin/ifplugd-daemon $nic
+
+ # use presence of PID file to check for start success
+ [[ -f /var/run/ifplugd.$nic.pid ]] || (( ++err ))
+ fi
+ done
+ unset nic
+
+ if (( err )); then
+ stat_fail
+ exit 1
+ else
+ add_daemon $daemonname
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping $daemonname: ${net_ifs[*]}"
+
+ for nic in /var/run/ifplugd.*.pid; do
+ [[ -f $nic ]] || { (( ++err )); break; }
+ nic=${nic%.pid}
+ nic=${nic##*.}
+ ifplugd -k -i "$nic" || (( ++err ))
+ done
+
+ if (( err )); then
+ stat_fail
+ exit 1
+ else
+ rm_daemon $daemonname
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ status)
+ for nic in "${net_ifs[@]}"; do
+ ifplugd -c -i "$nic"
+ done
+ unset nic
+ ;;
+ suspend)
+ stat_busy "Suspending $daemonname: ${net_ifs[*]}"
+ for nic in "${net_ifs[@]}"; do
+ ifplugd -S -i $nic || (( ++err ))
+ done
+ unset nic
+
+ if (( err )); then
+ stat_fail
+ exit 1
+ else
+ stat_done
+ fi
+ ;;
+ resume)
+ stat_busy "Resuming $daemonname ${net_ifs[*]}"
+
+ for nic in "${net_ifs[@]}"; do
+ ifplugd -R -i $nic || (( ++err ))
+ done
+ unset nic
+
+ if (( err )); then
+ stat_fail
+ exit 1
+ else
+ stat_done
+ fi
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|status|suspend|resume}"
+esac
+exit 0
diff --git a/src/incron/incron.init b/src/incron/incron.init
new file mode 100755
index 0000000..337c0fa
--- /dev/null
+++ b/src/incron/incron.init
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting Incrond"
+ /usr/sbin/incrond
+ add_daemon incrond
+ stat_done
+ ;;
+ stop)
+ stat_busy "Stopping Incrond"
+ PID=`pidof -o %PPID /usr/sbin/incrond`
+ [ -z "$PID" ] || kill $PID
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon incrond
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/src/inetutils/ftpd.rc b/src/inetutils/ftpd.rc
new file mode 100755
index 0000000..3d0d344
--- /dev/null
+++ b/src/inetutils/ftpd.rc
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/ftpd
+
+PID=$(pidof -o %PPID /usr/sbin/ftpd)
+case "$1" in
+ start)
+ stat_busy "Starting ftpd"
+ [ -z "$PID" ] && /usr/sbin/ftpd -D $FTPD_ARGS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ftpd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ftpd"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ftpd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/inn/innd.rc b/src/inn/innd.rc
new file mode 100755
index 0000000..5e36aec
--- /dev/null
+++ b/src/inn/innd.rc
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+[ -f /etc/conf.d/innd ] && . /etc/conf.d/innd
+[ -z "$NEWS_USER" ] && print "Please set news username" && exit 1;
+[ -z "$NEWS_GROUP" ] && print "Please set news groupname" && exit 1;
+
+case "$1" in
+ start)
+ stat_busy "Starting InterNetNews"
+ [ -d /var/run/inn ] || {
+ mkdir -p /var/run/inn
+ chown -R $NEWS_USER:$NEWS_GROUP /var/run/inn
+ }
+ su $NEWS_USER -c /usr/bin/rc.news 2>&- >&-
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo $! > /var/run/innd.pid
+ add_daemon innd
+ stat_done
+ fi
+
+ ;;
+ stop)
+ stat_busy "Stopping InterNetNews"
+ ctlinnd throttle "shutting down" 2>&- >&-
+ su $NEWS_USER -c /usr/bin/rc.news stop 2>&- >&-
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ kill `ps faxu| grep ^$NEWS_USER | awk -- '{print $2}'` 2>&- >&-
+ rm /var/run/innd.pid
+ rm_daemon innd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/inn/nnrpd.rc b/src/inn/nnrpd.rc
new file mode 100755
index 0000000..d7c9028
--- /dev/null
+++ b/src/inn/nnrpd.rc
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+[ -f /etc/conf.d/nnrpd ] && . /etc/conf.d/nnrpd
+[ -z "$NNRPD_OPTS" ] && print "FATAL: No arguments where passed" && exit 1;
+
+PID=`pidof -o %PPID nnrpd`
+case "$1" in
+ start)
+ stat_busy "Starting InterNetNews Readers Daemon"
+ if [ ! -f /var/run/nnrpd.pid ]; then
+ stat_append ":: InterNetNews (innd) is not running"
+ stat_fail
+ exit 1
+ fi
+
+ [ -d /var/run/inn ] || mkdir -p /var/run/inn
+ [ -z "$PID" ] && nnrpd $NNRPD_OPTS 2>&- >&-
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ PID=`pidof -o %PPID nnrpd`
+ echo $PID > /var/run/nnrpd.pid
+ add_daemon nnrpd
+ stat_done
+ fi
+
+ ;;
+ stop)
+ stat_busy "Stopping InterNetNews Readers Daemon"
+ [ ! -z "$PID" ] && kill $PID >&-
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm /var/run/nnrpd.pid
+ rm_daemon nnrpd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/inputattach/inputattach.rc.d b/src/inputattach/inputattach.rc.d
new file mode 100755
index 0000000..eb626e1
--- /dev/null
+++ b/src/inputattach/inputattach.rc.d
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/inputattach
+
+case "$1" in
+ start)
+ stat_busy "Starting inputattach"
+ for param in "${IAPARAMS[@]}"; do
+ if ! /usr/sbin/inputattach --daemon $param; then
+ stat_fail
+ exit 1
+ fi
+ done
+
+ add_daemon inputattach
+ stat_done
+ ;;
+ stop)
+ stat_busy "Stopping inputattach"
+ PID=`pidof -o %PPID /usr/sbin/inputattach`
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm_daemon inputattach
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/iperf/iperf.rc b/src/iperf/iperf.rc
new file mode 100755
index 0000000..617b666
--- /dev/null
+++ b/src/iperf/iperf.rc
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+# You can use this script to run iperf as tcp and udp.
+# Copy and rename this script to /etc/rc.d/iperf-udp and copy config file to
+# /etc/conf.d/iperf-udp and add -u to daemon options
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+[[ -r /etc/conf.d/${0##*/} ]] && . /etc/conf.d/${0##*/}
+
+DAEMON=${DAEMON:-/usr/bin/iperf}
+PIDFILE=${PIDFILE:-/run/${0##*/}.pid}
+DAEMON_OPTS="--server $DAEMON_OPTS"
+
+# check pid
+[[ -r "$PIDFILE" ]] &&
+ read PID < "$PIDFILE" && [[ -n $PID ]] && kill -0 $PID &>/dev/null || unset PID
+
+case "$1" in
+ start)
+ stat_busy "Starting ${0##*/} daemon"
+ [[ -z $PID ]] &&
+ { $DAEMON $DAEMON_OPTS </dev/null &>/dev/null & } &&
+ echo "$!" > "$PIDFILE" &&
+ disown %% &&
+ add_daemon ${0##*/} &&
+ stat_done &&
+ exit 0
+ stat_fail
+ ;;
+ stop)
+ stat_busy "Stopping ${0##*/} daemon"
+ [[ -n $PID ]] && kill $PID &> /dev/null &&
+ rm_daemon ${0##*/} &&
+ rm -f "$PIDFILE" &&
+ stat_done &&
+ exit 0
+ stat_fail
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit 0
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ ;;
+esac
+
+exit 1
+
+# vim:set ts=2 sw=2 ft=sh noet:
diff --git a/src/ipsec-tools/ipsec.rc b/src/ipsec-tools/ipsec.rc
new file mode 100755
index 0000000..cff472c
--- /dev/null
+++ b/src/ipsec-tools/ipsec.rc
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Loading IPSec Security Policy Database..."
+ /usr/sbin/setkey -f /etc/ipsec.conf &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ipsec
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Unloading IPSec Security Policy Database..."
+ /usr/sbin/setkey -F -P
+ /usr/sbin/setkey -F
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ipsec
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/ipsec-tools/racoon.rc b/src/ipsec-tools/racoon.rc
new file mode 100755
index 0000000..1a67dca
--- /dev/null
+++ b/src/ipsec-tools/racoon.rc
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/racoon`
+case "$1" in
+ start)
+ stat_busy "Starting Racoon IPSec daemon"
+ [ -z "$PID" ] && /usr/sbin/racoon
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon racoon
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Racoon IPSec daemon"
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon racoon
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/ipset/ipset.rc b/src/ipset/ipset.rc
new file mode 100755
index 0000000..517eff1
--- /dev/null
+++ b/src/ipset/ipset.rc
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+case "$1" in
+ start)
+ stat_busy 'Loading IP sets'
+ ipset restore < "$CONFIG_FILE" && add_daemon ${0##*/} && stat_done || stat_die
+ ;;
+ stop)
+ [[ $SAVE_ON_STOP =~ [yY][eE][sS] ]] && $0 save
+ stat_busy 'Clearing IP sets'
+ ipset destroy &&
+ rm_daemon ${0##*/} && stat_done || stat_die
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ save)
+ stat_busy 'Saving IP sets'
+ ipset save > "$CONFIG_FILE" &&
+ stat_done || stat_die
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart|save}" >&2
+ exit 1
+ ;;
+esac
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/iptables/ip6tables b/src/iptables/ip6tables
new file mode 100755
index 0000000..2d119e3
--- /dev/null
+++ b/src/iptables/ip6tables
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+# source application-specific settings
+[ -f /etc/conf.d/iptables ] && . /etc/conf.d/iptables
+
+# Set defaults if settings are missing
+[ -z "$IP6TABLES_CONF" ] && IP6TABLES_CONF=/etc/iptables/ip6tables.rules
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ if [ ! -f "$IP6TABLES_CONF" ]; then
+ echo "Cannot load ip6tables rules: $IP6TABLES_CONF is missing!" >&2
+ exit 1
+ fi
+ stat_busy "Starting IP6 Tables"
+ if [ "$IPTABLES_FORWARD" = "1" ]; then
+ echo 1 >/proc/sys/net/ipv6/conf/default/forwarding
+ echo 1 >/proc/sys/net/ipv6/conf/all/forwarding
+ fi
+ if ck_daemon ip6tables; then
+ /usr/sbin/ip6tables-restore < $IP6TABLES_CONF
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ip6tables
+ stat_done
+ fi
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping IP6 Tables"
+ if ! ck_daemon ip6tables; then
+ fail=0
+ for table in $(cat /proc/net/ip6_tables_names); do
+ ip6tables-restore < /var/lib/iptables/empty-$table.rules
+ [ $? -gt 0 ] && fail=1
+ done
+ if [ $fail -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ip6tables
+ stat_done
+ fi
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ save)
+ stat_busy "Saving IP6 Tables"
+ /usr/sbin/ip6tables-save >$IP6TABLES_CONF
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|save}"
+esac
+exit 0
diff --git a/src/iptables/iptables b/src/iptables/iptables
new file mode 100755
index 0000000..fbb02fa
--- /dev/null
+++ b/src/iptables/iptables
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+# source application-specific settings
+[ -f /etc/conf.d/iptables ] && . /etc/conf.d/iptables
+
+# Set defaults if settings are missing
+[ -z "$IPTABLES_CONF" ] && IPTABLES_CONF=/etc/iptables/iptables.rules
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ if [ ! -f "$IPTABLES_CONF" ]; then
+ echo "Cannot load iptables rules: $IPTABLES_CONF is missing!" >&2
+ exit 1
+ fi
+ stat_busy "Starting IP Tables"
+ if [ "$IPTABLES_FORWARD" = "1" ]; then
+ echo 1 >/proc/sys/net/ipv4/ip_forward
+ fi
+ if ck_daemon iptables; then
+ /usr/sbin/iptables-restore < $IPTABLES_CONF
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon iptables
+ stat_done
+ fi
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping IP Tables"
+ if ! ck_daemon iptables; then
+ fail=0
+ for table in $(cat /proc/net/ip_tables_names); do
+ iptables-restore < /var/lib/iptables/empty-$table.rules
+ [ $? -gt 0 ] && fail=1
+ done
+ if [ $fail -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon iptables
+ stat_done
+ fi
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ save)
+ stat_busy "Saving IP Tables"
+ /usr/sbin/iptables-save >$IPTABLES_CONF
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|save}"
+esac
+exit 0
diff --git a/src/ipvsadm/ipvsadm.rc b/src/ipvsadm/ipvsadm.rc
new file mode 100755
index 0000000..b810dcd
--- /dev/null
+++ b/src/ipvsadm/ipvsadm.rc
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+case "$1" in
+ start)
+ stat_busy 'Loading IPVS table'
+ ipvsadm-restore < "$CONFIG_FILE" &&
+ add_daemon ${0##*/} && stat_done || stat_die
+ ;;
+ stop)
+ [[ $SAVE_ON_STOP =~ [yY][eE][sS] ]] && $0 save
+ stat_busy 'Clearing IPVS table'
+ ipvsadm -C && rm_daemon ${0##*/} && stat_done || stat_die
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ save)
+ stat_busy 'Saving IPVS table'
+ ipvsadm-save -n > "$CONFIG_FILE" && stat_done || stat_die
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart|save}" >&2
+ exit 1
+esac
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/irqbalance/irqbalance.rc.d b/src/irqbalance/irqbalance.rc.d
new file mode 100755
index 0000000..987c26b
--- /dev/null
+++ b/src/irqbalance/irqbalance.rc.d
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# source application-specific settings
+ONESHOT=0
+[ -f /etc/conf.d/irqbalance ] && . /etc/conf.d/irqbalance
+
+if [ "$ONESHOT" -ne 0 ]; then
+ ONESHOT_CMD="--oneshot"
+fi
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/irqbalance`
+case "$1" in
+ start)
+ stat_busy "Starting IRQ balancing"
+ [ -z "$PID" ] && /usr/sbin/irqbalance $ONESHOT_CMD
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ if [ "$ONESHOT" -eq 0 ]; then
+ add_daemon irqbalance
+ fi
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping IRQ balancing"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon irqbalance
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/jmc/jmc.rc b/src/jmc/jmc.rc
new file mode 100755
index 0000000..f0130bf
--- /dev/null
+++ b/src/jmc/jmc.rc
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ [ -f /var/run/jmc.pid ] && echo `cat /var/run/jmc.pid`
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting jabber mail component daemon"
+
+ [ -f /var/run/jmc.pid ] && rm -f /var/run/jmc.pid
+ PID=`get_pid`
+ if [ -z "$PID" ]; then
+ cd /usr/lib/jmc && python2 jmc.py -c /etc/ejabberd/jmc.xml 1>>/var/log/ejabberd/jmc1.log 2>>/var/log/ejabberd/jmc2.log &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon jmc
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping jabber mail component daemon"
+ PID=`get_pid`
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/jmc.pid &> /dev/null
+ rm_daemon jmc
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/kdebase-workspace/kdm b/src/kdebase-workspace/kdm
new file mode 100755
index 0000000..799d58f
--- /dev/null
+++ b/src/kdebase-workspace/kdm
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=$(pidof -o %PPID /usr/bin/kdm)
+case "$1" in
+ start)
+ stat_busy "Starting KDE Desktop Manager"
+ [ -z "$PID" ] && /usr/bin/kdm &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon kdm
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping KDE Desktop Manager"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon kdm
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/keepalived/keepalived.rc b/src/keepalived/keepalived.rc
new file mode 100755
index 0000000..0ecfc7d
--- /dev/null
+++ b/src/keepalived/keepalived.rc
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+DAEMON=/usr/sbin/keepalived
+PID=$(pidof -o %PPID $DAEMON)
+
+case "$1" in
+ start)
+ stat_busy "Starting ${0##*/} daemon"
+ [[ ! $PID ]] && $DAEMON $DAEMON_OPTS && add_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ stop)
+ stat_busy "Stopping ${0##*/} daemon"
+ [[ $PID ]] && kill $PID &> /dev/null && rm_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit 0
+ ;;
+ reload)
+ stat_busy "Reloading ${0##*/} daemon"
+ [[ $PID ]] && kill -HUP $PID &> /dev/null && stat_done && exit 0
+ stat_fail
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart|reload}" >&2
+ ;;
+esac
+
+exit 1
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/kexec-tools/kexec b/src/kexec-tools/kexec
new file mode 100755
index 0000000..c2e9a78
--- /dev/null
+++ b/src/kexec-tools/kexec
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+[ -f /etc/conf.d/kexec ] && . /etc/conf.d/kexec
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Enabling kexec on reboot"
+ add_daemon kexec
+ stat_done
+ ;;
+
+ stop|load)
+ if [ "$RUNLEVEL" = "6" -o "$1" = "load" ]; then
+ stat_busy "Loading kexec kernel"
+ [ -f "$KPATH" ] || stat_fail
+ [ -f "$INITRD" ] && _INITRD="--initrd=$INITRD"
+ /sbin/kexec -l $KPATH --append="root=$ROOTPART $KPARAM" $_INITRD > /dev/null 2>&1
+ else
+ stat_busy "Disabling kexec on reboot"
+ fi
+ if [ $? -eq 0 ] ; then
+ rm_daemon kexec
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+
+ unload)
+ stat_busy "Unloading kexec kernel"
+ /sbin/kexec -u
+ if [ $? -eq 0 ] ; then
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|load|unload}"
+esac
+exit 0
diff --git a/src/krb5/krb5-kadmind b/src/krb5/krb5-kadmind
new file mode 100755
index 0000000..04df0dc
--- /dev/null
+++ b/src/krb5/krb5-kadmind
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/kadmind`
+case "$1" in
+ start)
+ stat_busy "Starting Kerberos Admin Daemon"
+ if [ -z "$PID" ]; then
+ /usr/sbin/kadmind
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon krb5-kadmind
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Kerberos Admin Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon krb5-kadmind
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/src/krb5/krb5-kdc b/src/krb5/krb5-kdc
new file mode 100755
index 0000000..05a0341
--- /dev/null
+++ b/src/krb5/krb5-kdc
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/krb5kdc`
+case "$1" in
+ start)
+ stat_busy "Starting Kerberos Authentication"
+ if [ -z "$PID" ]; then
+ /usr/sbin/krb5kdc
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon krb5-kdc
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Kerberos Authentication"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon krb5-kdc
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/src/krb5/krb5-kpropd b/src/krb5/krb5-kpropd
new file mode 100755
index 0000000..a0077d6
--- /dev/null
+++ b/src/krb5/krb5-kpropd
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/kpropd`
+case "$1" in
+ start)
+ stat_busy "Starting Kerberos Database Propagation Daemon"
+ if [ -z "$PID" ]; then
+ /usr/sbin/kpropd -S
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon kpropd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Kerberos Database Propagation Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon kpropd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/src/laptop-mode-tools/laptop-mode b/src/laptop-mode-tools/laptop-mode
new file mode 100755
index 0000000..a0ddb9c
--- /dev/null
+++ b/src/laptop-mode-tools/laptop-mode
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting laptop-mode"
+ [ ! -d /var/run/laptop-mode-tools ] && install -d /var/run/laptop-mode-tools
+ touch /var/run/laptop-mode-tools/enabled
+ /usr/sbin/laptop_mode auto >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon laptop-mode
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping laptop-mode"
+ rm -f /var/run/laptop-mode-tools/enabled
+ /usr/sbin/laptop_mode stop >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon laptop-mode
+ stat_done
+ fi
+ ;;
+ restart)
+ stat_busy "Restarting laptop-mode"
+ rm -f /var/run/laptop-mode-tools/enabled
+ /usr/sbin/laptop_mode stop >/dev/null 2>&1
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ rm_daemon laptop-mode
+ else
+ rm -f /var/run/laptop-mode-tools/*
+ touch /var/run/laptop-mode-tools/enabled
+ /usr/sbin/laptop_mode auto force >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ rm_daemon laptop-mode
+ else
+ stat_done
+ fi
+ fi
+ ;;
+ status)
+ /usr/sbin/laptop_mode status
+ ;;
+ *)
+ echo "Usage: $0 {stop|start|restart|status}"
+ ;;
+esac
+exit 0
diff --git a/src/lastfmsubmitd/lastfmsubmitd b/src/lastfmsubmitd/lastfmsubmitd
new file mode 100755
index 0000000..e92027b
--- /dev/null
+++ b/src/lastfmsubmitd/lastfmsubmitd
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+daemon_name=lastfmsubmitd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ pidof -x -o %PPID -o $$ -o $PPID $daemon_name
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting LastFMSubmitd"
+ PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
+ /usr/bin/$daemon_name
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ [ -d /var/run/lastfm ] || mkdir -p var/run/lastfm
+ echo $(get_pid) >/var/run/lastfm/$daemon_name.pid
+ add_daemon $daemon_name
+ stat_done
+ fi
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping LastFMSubmitd"
+ PID=$(get_pid)
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/$daemon_name.pid &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/src/lastfmsubmitd/lastmp b/src/lastfmsubmitd/lastmp
new file mode 100755
index 0000000..11cfe4c
--- /dev/null
+++ b/src/lastfmsubmitd/lastmp
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+daemon_name=lastmp
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ pidof -x -o %PPID -o $$ -o $PPID $daemon_name
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting LastMP"
+ PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
+ /usr/bin/$daemon_name
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ [ -d /var/run/lastfm ] || mkdir -p var/run/lastfm
+ echo $(get_pid) >/var/run/lastfm/$daemon_name.pid
+ add_daemon $daemon_name
+ stat_done
+ fi
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping LastMP"
+ PID=$(get_pid)
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/$daemon_name.pid &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/src/libsasl/saslauthd b/src/libsasl/saslauthd
new file mode 100755
index 0000000..6afafae
--- /dev/null
+++ b/src/libsasl/saslauthd
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+# source application-specific settings
+[ -f /etc/conf.d/saslauthd ] && . /etc/conf.d/saslauthd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DAEMON_NAME="saslauthd"
+SASLAUTHD_BIN=/usr/sbin/saslauthd
+SASLAUTHD_RUN=/var/run/saslauthd
+SASLAUTHD_PID=$SASLAUTHD_RUN/saslauthd.pid
+
+case "$1" in
+ start)
+ stat_busy "Starting $DAEMON_NAME"
+ [ ! -d /var/run/saslauthd ] && install -d /var/run/saslauthd
+ if $SASLAUTHD_BIN $SASLAUTHD_OPTS >/dev/null; then
+ add_daemon $DAEMON_NAME
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $DAEMON_NAME"
+ [ -f $SASLAUTHD_PID ] && kill `cat $SASLAUTHD_PID` &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm_daemon $DAEMON_NAME
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
+# vim: ts=2 sw=2 et ft=sh
diff --git a/src/libvirt/libvirtd-guests.rc.d b/src/libvirt/libvirtd-guests.rc.d
new file mode 100755
index 0000000..3100b34
--- /dev/null
+++ b/src/libvirt/libvirtd-guests.rc.d
@@ -0,0 +1,161 @@
+#!/bin/bash
+
+source /etc/conf.d/libvirtd-guests
+[ -f /etc/rc.conf ] && source /etc/rc.conf
+
+if [ -f /etc/rc.d/functions ]; then
+ . /etc/rc.d/functions
+else
+ stat_busy() {
+ echo "$*"
+ }
+
+ stat_fail() {
+ echo "FAIL"
+ }
+
+ stat_done() {
+ echo "DONE"
+ }
+
+ add_daemon() {
+ true
+ }
+
+ rm_daemon() {
+ true
+ }
+fi
+
+
+LIBVIRTD_LISTFILE="/var/state/libvirtd/vm-list"
+
+# get guest state by name
+libvirt_get_guest_state()
+{
+ virsh $LIBVIRTD_URI dominfo "$1" | grep -E '^State:' | awk '{print $2}'
+}
+
+# list IDs of running guests
+libvirt_list()
+{
+
+ list=$(virsh $LIBVIRTD_URI list)
+
+ if [ $? -ne 0 ]; then
+ RETVAL=1
+ return 1
+ fi
+
+ uuids=
+ for id in $(echo "$list" | awk 'NR > 2 {print $1}'); do
+ uuid=$(virsh $LIBVIRTD_UTI dominfo $id | awk '/^UUID:/{print $2}')
+ if [ -z "$uuid" ]; then
+ RETVAL=1
+ return 1
+ fi
+ uuids="$uuids $uuid"
+ done
+
+ echo $uuids
+
+}
+
+libvirt_domname()
+{
+ uuid=$1
+ name=$(virsh $LIBVIRTD_URI dominfo $uuid | awk 'NR == 2 {$1=""; print}')
+
+ echo $name
+}
+
+# suspend guest by name
+libvirt_suspend()
+{
+ virsh $LIBVIRTD_URI $LIBVIRTD_BYPASS_CACHE managedsave "$1" >/dev/null
+ timeout=$LIBVIRTD_SHUTDOWN_TIMEOUT
+ while [ "$timeout" -gt 0 ]; do
+ sleep 1
+ timeout=$((timeout - 1))
+ state=`libvirt_get_guest_state "$1"`
+ [ "x$state" == "xshut" ] && return 0
+ done
+ return 1
+}
+
+# shutdown guest by name
+libvirt_shutdown()
+{
+ virsh $LIBVIRTD_URI shutdown "$1" >/dev/null
+ timeout=$LIBVIRTD_SHUTDOWN_TIMEOUT
+ while [ "$timeout" -gt 0 ]; do
+ sleep 1
+ timeout=$((timeout - 1))
+ state=`libvirt_get_guest_state "$1"`
+ [ "x$state" == "xshut" ] && return 0
+ done
+ return 1
+}
+
+# start guest by name
+libvirt_start()
+{
+ virsh $LIBVIRTD_URI $LIBVIRTD_BYPASS_CACHE start "$1" >/dev/null
+}
+
+# stop all guests
+libvirt_stop_all()
+{
+ mkdir -p `dirname $LIBVIRTD_LISTFILE`
+ echo -n >$LIBVIRTD_LISTFILE
+
+ for i in `libvirt_list`; do
+ name=`libvirt_domname $i`
+ if [ "x$LIBVIRTD_STOP_ACTION" == "xsuspend" ]; then
+ stat_busy "Suspending libvirtd/$name guest"
+ libvirt_suspend "$i"
+ else
+ stat_busy "Shutting libvirtd/$i guest down"
+ libvirt_shutdown "$i"
+ fi
+ [ $? -eq 0 ] && stat_done || stat_fail
+ echo $i >>$LIBVIRTD_LISTFILE
+ done
+}
+
+# start all guests
+libvirt_start_all()
+{
+ if [ -f $LIBVIRTD_LISTFILE ]; then
+ for i in `cat $LIBVIRTD_LISTFILE`; do
+ name=`libvirt_domname $i`
+ stat_busy "Starting/resuming libvirtd/$name guest"
+ libvirt_start "$i"
+ [ $? -eq 0 ] && { sleep $LIBVIRTD_START_DELAY; stat_done; } || stat_fail
+ done
+ fi
+ rm -f $LIBVIRTD_LISTFILE
+}
+
+# main
+LC_ALL=C
+LANG=C
+case "$1" in
+ start)
+ libvirt_start_all
+ add_daemon libvirtd-guests
+ ;;
+ stop)
+ libvirt_stop_all
+ rm_daemon libvirtd-guests
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/src/libvirt/libvirtd.rc.d b/src/libvirt/libvirtd.rc.d
new file mode 100755
index 0000000..193bffa
--- /dev/null
+++ b/src/libvirt/libvirtd.rc.d
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/conf.d/libvirtd
+. /etc/rc.d/functions
+
+LIBVIRTD_CONFIG_ARGS=
+if [ -n "$LIBVIRTD_CONFIG" ]
+then
+ LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
+fi
+
+PID=`pidof -o %PPID /usr/sbin/libvirtd`
+case "$1" in
+ start)
+ stat_busy "Starting libvirtd"
+ export RADVD=/usr/sbin/radvd
+ for i in /var/run/libvirt/qemu /var/run/libvirt/lxc /var/run/libvirt/uml /var/run/libvirt/network; do
+ [ -d $i ] || mkdir -p $i
+ done
+ [ -z "$PID" ] && (
+ mkdir -p /var/{cache,run}/libvirt
+ rm -rf /var/cache/libvirt/*
+ KRB5_KTNAME=$KRB5_KTNAME \
+ /usr/sbin/libvirtd --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
+ )
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon libvirtd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping libvirtd"
+ [ ! -z "$PID" ] && (
+ kill $PID &> /dev/null
+ rm -rf /var/cache/libvirt/*
+ rm -f /var/run/libvirtd.pid
+ )
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon libvirtd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ reload)
+ stat_busy "Reloading libvirtd configuration"
+ [ ! -z "$PID" ] && kill -HUP $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|reload}"
+ ;;
+esac
+exit 0
diff --git a/src/lighttpd/lighttpd.rc.d b/src/lighttpd/lighttpd.rc.d
new file mode 100755
index 0000000..c2c41b8
--- /dev/null
+++ b/src/lighttpd/lighttpd.rc.d
@@ -0,0 +1,127 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+
+pid_file='/run/lighttpd/lighttpd-angel.pid'
+
+get_pid() {
+ if [ -r "${pid_file}" ]; then
+ cat "${pid_file}"
+ else
+ pgrep -f /usr/sbin/lighttpd-angel
+ fi
+}
+
+test_config() {
+ stat_busy 'Checking configuration'
+ if [ $(id -u) -ne 0 ]; then
+ stat_append '(This script must be run as root)'
+ stat_die
+ fi
+
+ if [ ! -r /etc/lighttpd/lighttpd.conf ]; then
+ stat_append '(/etc/lighttpd/lighttpd.conf not found)'
+ stat_die
+ fi
+
+ /usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_append '(error in /etc/lighttpd/lighttpd.conf)'
+ stat_die
+ fi
+
+ stat_done
+}
+
+start() {
+ stat_busy 'Starting lighttpd'
+
+ local PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ nohup /usr/sbin/lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf >>/var/log/lighttpd/lighttpd-angel.log 2>&1 &
+ if [ $? -gt 0 ]; then
+ stat_die
+ else
+ echo $! > "${pid_file}"
+ add_daemon lighttpd
+ stat_done
+ fi
+ else
+ stat_die
+ fi
+}
+
+stop() {
+ stat_busy 'Stopping lighttpd'
+ local PID=$(get_pid)
+ [ -n "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ [ -f "${pid_file}" ] && rm -f "${pid_file}"
+ rm_daemon lighttpd
+ stat_done
+ fi
+}
+
+gracefull-stop() {
+ stat_busy 'Stopping lighttpd gracefully'
+ local PID=$(get_pid)
+ [ -n "$PID" ] && kill -INT $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ [ -f "${pid_file}" ] && rm -f "${pid_file}"
+ rm_daemon lighttpd
+ stat_done
+ fi
+}
+
+reload() {
+ stat_busy 'Reloading lighttpd'
+ local PID=$(get_pid)
+ [ -n "$PID" ] && kill -HUP $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_die
+ else
+ stat_done
+ fi
+}
+
+
+case "$1" in
+ start)
+ test_config
+ start
+ ;;
+ stop)
+ test_config
+ stop
+ ;;
+ gracefull-stop)
+ test_config
+ stop
+ ;;
+ reload)
+ test_config
+ reload
+ ;;
+ restart)
+ test_config
+ stop
+ while [ -n "$(get_pid)" ]; do
+ sleep 1
+ done
+ start
+ ;;
+ status)
+ stat_busy 'Checking lighttpd status'
+ ck_status lighttpd
+ ;;
+ *)
+ echo "usage: $0 {start|stop|gracefull-stop|reload|restart|status}"
+esac
+
+exit 0
diff --git a/src/linux-tools/cpupower.rc b/src/linux-tools/cpupower.rc
new file mode 100755
index 0000000..88edaf7
--- /dev/null
+++ b/src/linux-tools/cpupower.rc
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start|restart)
+ status 'Setting cpupower rules' /usr/lib/systemd/scripts/cpupower || exit 1
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|restart}" >&2
+ exit 1
+ ;;
+esac
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/linux-tools/usbipd.rc b/src/linux-tools/usbipd.rc
new file mode 100755
index 0000000..15a1bcf
--- /dev/null
+++ b/src/linux-tools/usbipd.rc
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+DAEMON=/usr/sbin/usbipd
+PID=$(pidof -o %PPID $DAEMON)
+DAEMON_OPTS="--daemon $DAEMON_OPTS"
+
+case "$1" in
+ start)
+ stat_busy "Starting ${0##*/} daemon"
+ [[ ! $PID ]] && $DAEMON $DAEMON_OPTS && add_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ stop)
+ stat_busy "Stopping ${0##*/} daemon"
+ [[ $PID ]] && kill $PID &> /dev/null && rm_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit 0
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ ;;
+esac
+
+exit 1
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/lirc/irexecd b/src/lirc/irexecd
new file mode 100755
index 0000000..a64b033
--- /dev/null
+++ b/src/lirc/irexecd
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/irexec.conf
+
+PID=`pidof -o %PPID /usr/bin/irexec`
+case "$1" in
+ start)
+ stat_busy "Starting IREXEC Daemon"
+ [ -z "$PID" ] && /usr/bin/irexec --daemon $IREXEC_OPTS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon irexecd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping IREXEC Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon irexecd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
+
diff --git a/src/lirc/lircd b/src/lirc/lircd
new file mode 100755
index 0000000..e9739b3
--- /dev/null
+++ b/src/lirc/lircd
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/lircd.conf
+
+PID=$(pidof -o %PPID /usr/sbin/lircd)
+LIRCD_SYMLINKFILE=/dev/lircd
+LIRCD_SOCKET=/var/run/lirc/lircd
+case "$1" in
+ start)
+ stat_busy "Starting LIRC Daemon"
+ [ ! -d /var/run/lirc ] && install -d /var/run/lirc &>/dev/null
+ rm -f $LIRCD_SOCKET && ln -s $LIRCD_SOCKET $LIRCD_SYMLINKFILE
+ if [ $? -ne 0 ]; then
+ stat_fail
+ exit 0
+ fi
+ [ -n "$LIRC_DRIVER" ] && LIRC_EXTRAOPTS="-H $LIRC_DRIVER $LIRC_EXTRAOPTS"
+ [ -z "$PID" ] &&
+ if [ -n "$LIRC_DEVICE" ] ; then
+ eval /usr/sbin/lircd -d "$LIRC_DEVICE" $LIRC_EXTRAOPTS $LIRC_CONFIGFILE
+ else
+ /usr/sbin/lircd $LIRC_EXTRAOPTS $LIRC_CONFIGFILE
+ fi
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon lircd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping LIRC Daemon"
+ rm -f $LIRCD_SYMLINKFILE
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon lircd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 start|stop|restart"
+esac
+exit 0
diff --git a/src/lirc/lircmd b/src/lirc/lircmd
new file mode 100755
index 0000000..220c47c
--- /dev/null
+++ b/src/lirc/lircmd
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/lircmd`
+case "$1" in
+ start)
+ stat_busy "Starting lircmd Daemon"
+ [ -z "$PID" ] && /usr/sbin/lircmd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon lircmd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping lircmd Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon lircmd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/lm_sensors/fancontrol.rc b/src/lm_sensors/fancontrol.rc
new file mode 100755
index 0000000..8e98d06
--- /dev/null
+++ b/src/lm_sensors/fancontrol.rc
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=$(pidof -o %PPID -x /usr/sbin/fancontrol)
+case "$1" in
+ start)
+ stat_busy "Starting fancontrol"
+ [ -z "$PID" ] && /usr/sbin/fancontrol -D &>/dev/null
+ if [ $? -gt 0 -o -n "$PID" ]; then
+ stat_fail
+ else
+ add_daemon fancontrol
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping fancontrol"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon fancontrol
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/lm_sensors/healthd.rc b/src/lm_sensors/healthd.rc
new file mode 100755
index 0000000..f50f4a6
--- /dev/null
+++ b/src/lm_sensors/healthd.rc
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=$(pidof -x -o %PPID /usr/sbin/healthd)
+case "${1}" in
+ start)
+ stat_busy "Starting Health Daemon"
+ [ -z "${PID}" ] && /usr/sbin/healthd &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo "${PID}" > /var/run/healthd.pid
+ add_daemon healthd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Health Daemon"
+ [ ! -z "${PID}" ] && kill ${PID} &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon healthd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *) echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/lm_sensors/sensord.rc b/src/lm_sensors/sensord.rc
new file mode 100755
index 0000000..e3ef4d2
--- /dev/null
+++ b/src/lm_sensors/sensord.rc
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/sensord
+
+PID=$(pidof -o %PPID /usr/sbin/sensord)
+case "$1" in
+ start)
+ stat_busy "Starting sensord"
+ [ -z "$PID" ] && /usr/sbin/sensord ${SENSORD_ARGS}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon sensord
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping sensord"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon sensord
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/lm_sensors/sensors.rc b/src/lm_sensors/sensors.rc
new file mode 100755
index 0000000..4acde22
--- /dev/null
+++ b/src/lm_sensors/sensors.rc
@@ -0,0 +1,119 @@
+#!/bin/bash
+
+# description: sensors is used for monitoring motherboard sensor values.
+# config: /etc/conf.d/lm_sensors
+
+# See also the lm_sensors homepage at:
+# http://www2.lm-sensors.nu/~lm78/index.html
+
+# It uses a config file /etc/conf.d/lm_sensors that contains the modules to
+# be loaded/unloaded. That file is sourced into this one.
+
+# The format of that file a shell script that simply defines the modules
+# in order as normal shell variables with the special names:
+# MODULE_1, MODULE_2, MODULE_3, etc.
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PSENSORS=/usr/bin/sensors
+
+if $(grep -q sysfs /proc/mounts); then
+ WITHSYS=1
+else
+ WITHSYS=0
+fi
+
+if [ $WITHSYS == "0" ]; then
+ # If sensors isn't supported by the kernel, try loading the module...
+ [ -e /proc/sys/dev/sensors ] || /sbin/modprobe i2c-proc &>/dev/null
+
+ # Don't bother if /proc/sensors still doesn't exist, kernel doesn't have support for sensors.
+ if ! [ -e /proc/sys/dev/sensors ]; then
+ echo "lm_sensors: kernel does not have sensors support"
+ stat_fail
+ fi
+
+ # If sensors was not already running, unload the module...
+ [ -e /var/run/daemons/sensors ] || /sbin/modprobe -r i2c-proc &>/dev/null
+fi
+
+if [ -e /etc/conf.d/lm_sensors ]; then
+ CONFIG=/etc/conf.d/lm_sensors
+elif [ -e /etc/sysconfig/lm_sensors ]; then
+ # Moving config to new Arch-specific location
+ mv /etc/sysconfig/lm_sensors /etc/conf.d/lm_sensors
+ CONFIG=/etc/conf.d/lm_sensors
+fi
+
+case "$1" in
+ start)
+ stat_busy "Starting Up Sensors"
+
+ if [ -r "$CONFIG" ]; then
+ . "$CONFIG"
+ modules=$(grep \^MODULE_ $CONFIG | wc -l | tr -d ' ')
+ i=0
+ while [ $i -lt $modules ] ; do
+ module=$(eval echo '$'MODULE_$i)
+ # echo starting module __${module}__ #debug
+ /sbin/modprobe $module &>/dev/null
+ i=$(expr $i + 1)
+ done
+ fi
+
+ $PSENSORS -s
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon sensors
+ stat_done
+ fi
+ ;;
+
+ stop)
+ stat_busy "Shutting Down Sensors"
+
+ if [ -r "$CONFIG" ]; then
+ . "$CONFIG"
+ modules=$(grep \^MODULE_ $CONFIG | wc -l | tr -d ' ')
+ i=$(expr $modules - 1)
+ while [ $i -ge 0 ] ; do
+ module=$(eval echo '$'MODULE_$i)
+ # echo stoping module __${module}__ #debug
+ /sbin/modprobe -r $module &>/dev/null
+ i=$(expr $i - 1)
+ done
+ fi
+
+ if [ $WITHSYS == "0" ]; then
+ /sbin/modprobe -r i2c-proc &>/dev/null
+ fi
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon sensors
+ stat_done
+ fi
+ ;;
+
+ status)
+ $PSENSORS
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ condrestart)
+ [ -e /var/run/daemons/sensors ] && $0 restart || :
+ ;;
+
+ *)
+ echo "Usage: $0 {start|stop|restart|status|condrestart}"
+esac
+exit 0
diff --git a/src/lxdm/rc.d b/src/lxdm/rc.d
new file mode 100755
index 0000000..68eb622
--- /dev/null
+++ b/src/lxdm/rc.d
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=$(pidof -o %PPID `which lxdm-binary`)
+case "$1" in
+ start)
+ stat_busy "Starting LXDM Display Manager"
+ [ -z "$PID" ] && /usr/sbin/lxdm -d &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon lxdm
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping LXDM Display Manager"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon lxdm
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/mailman/mailman.rc b/src/mailman/mailman.rc
new file mode 100755
index 0000000..79c1cd6
--- /dev/null
+++ b/src/mailman/mailman.rc
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+MAILMANCTL=/usr/lib/mailman/bin/mailmanctl
+
+case "$1" in
+ start)
+ status 'Starting GNU Mailing List Manager' $MAILMANCTL -q start &&
+ add_daemon ${0##*/} || exit 1
+ ;;
+ stop)
+ status 'Stoping GNU Mailing List Manager' $MAILMANCTL -q stop &&
+ rm_daemon ${0##*/} || exit 1
+ ;;
+ reload)
+ status 'Reloading GNU Mailing List Manager' $MAILMANCTL -q restart
+ ;;
+ restart)
+ $0 stop && $0 start
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart|reload}" >&2
+ ;;
+esac
+
+:
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/mariadb/rc.d b/src/mariadb/rc.d
new file mode 100755
index 0000000..e9fe8f5
--- /dev/null
+++ b/src/mariadb/rc.d
@@ -0,0 +1,77 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+getPID() {
+ echo $(pgrep -u mysql mysqld 2>/dev/null);
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting MariaDB Server"
+ [ ! -d /var/run/mysqld ] && install -d -g mysql -o mysql /var/run/mysqld &>/dev/null
+ if [ -z "$(getPID)" ]; then
+ /usr/bin/mysqld_safe --user=mysql &>/dev/null &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ timeo=30
+ while [ $timeo -gt 0 ]; do
+ response=`/usr/bin/mysqladmin -uUNKNOWN_USER ping 2>&1` && break
+ echo "$response" | grep -q "mysqld is alive" && break
+ sleep 1
+ let timeo=${timeo}-1
+ done
+ if [ $timeo -eq 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo $(getPID) > /var/run/mysqld/mysqld.pid
+ add_daemon mysqld
+ stat_done
+ fi
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping MariaDB Server"
+ if [ ! -z "$(getPID)" ]; then
+ timeo=30
+ kill $(getPID) &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ fi
+ while [ ! -z "$(getPID)" -a $timeo -gt 0 ]; do
+ sleep 1
+ let timeo=${timeo}-1
+ done
+ if [ -z "$(getPID)" ]; then
+ rm -f /var/run/mysqld/mysqld.pid &>/dev/null
+ rm_daemon mysqld
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/mcelog/mcelog.rc b/src/mcelog/mcelog.rc
new file mode 100755
index 0000000..fb73743
--- /dev/null
+++ b/src/mcelog/mcelog.rc
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/mcelog`
+case "$1" in
+ start)
+ stat_busy "Starting mcelog"
+ if [ -z "$PID" ]; then
+ /usr/sbin/mcelog --daemon --pidfile /var/run/mcelog.pid
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon mcelog
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping mcelog"
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon mcelog
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/mdadm/mdadm b/src/mdadm/mdadm
new file mode 100755
index 0000000..9bf468e
--- /dev/null
+++ b/src/mdadm/mdadm
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+pidfile=/run/mdadm.pid
+if [[ -r $pidfile ]]; then
+ read -r PID <"$pidfile"
+ if [[ $PID && ! -d /proc/$PID ]]; then
+ # stale pidfile
+ unset PID
+ rm -f "$pidfile"
+ fi
+fi
+
+case $1 in
+ start)
+ stat_busy "Starting mdadm RAID Monitor"
+ if [[ -z $PID ]] && mdadm --monitor --scan -i "$pidfile" -f; then
+ add_daemon mdadm
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping mdadm RAID Monitor"
+ if [[ $PID ]] && kill "$PID" &>/dev/null; then
+ rm_daemon mdadm
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/mediaproxy/mediaproxy.init b/src/mediaproxy/mediaproxy.init
new file mode 100755
index 0000000..ba9fe90
--- /dev/null
+++ b/src/mediaproxy/mediaproxy.init
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# mediaproxy starts and stops the SER MediaProxy server
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting mediaproxy"
+ media-dispatcher && media-relay
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping mediaproxy"
+ kill `cat /var/run/mediaproxy/relay.pid`
+ kill `cat /var/run/mediaproxy/dispatcher.pid`
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
diff --git a/src/memcached/memcached.sh b/src/memcached/memcached.sh
new file mode 100755
index 0000000..9c97275
--- /dev/null
+++ b/src/memcached/memcached.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/memcached
+
+PIDFILE='/var/run/memcached.pid'
+
+getpid() {
+ local pid
+ pid=$(cat $PIDFILE 2>/dev/null)
+ # if the process is no longer valid, don't return it
+ if [ -n "$pid" ]; then
+ if ! ps -p $pid >/dev/null; then
+ rm -f $PIDFILE
+ pid=""
+ fi
+ fi
+ echo $pid
+}
+
+PID="$(getpid)"
+
+case "$1" in
+ start)
+ stat_busy "Starting memcached"
+ # memcached is retarded and doesn't write to the pidfile
+ # before it drops permissions
+ if [ -n "$PID" ]; then
+ stat_fail
+ elif [ -z "$MEMCACHED_USER" ]; then
+ echo "MEMCACHED_USER must be defined in /etc/conf.d/memcached"
+ stat_fail
+ else
+ touch $PIDFILE && chown $MEMCACHED_USER $PIDFILE
+ /usr/bin/memcached -d -P $PIDFILE -u $MEMCACHED_USER $MEMCACHED_ARGS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon memcached
+ stat_done
+ fi
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping memcached"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f $PIDFILE
+ rm_daemon memcached
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/metalog/metalog b/src/metalog/metalog
new file mode 100755
index 0000000..2110024
--- /dev/null
+++ b/src/metalog/metalog
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+# source application-specific settings
+[ -f /etc/conf.d/metalog ] && . /etc/conf.d/metalog
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+if [ -f /var/run/metalog.pid ]; then
+ PID=$(cat /var/run/metalog.pid) 2>/dev/null
+fi
+
+case "$1" in
+ start)
+ stat_busy "Starting Metalog"
+ [ -z "$PID" ] && /usr/sbin/metalog -B $METALOG_OPTS 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon metalog
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Metalog"
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon metalog
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/mfs/mfscgiserv b/src/mfs/mfscgiserv
new file mode 100755
index 0000000..2f176d2
--- /dev/null
+++ b/src/mfs/mfscgiserv
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=$(ps aux | grep -v grep | grep /usr/bin/mfscgiserv | awk '{print $2}')
+case "$1" in
+ start)
+ stat_busy "Starting MooseFS CGI Web Frontend Daemon"
+ [ -z "$PID" ] && /usr/bin/mfscgiserv &> /dev/null
+ if [ $? = 0 ]; then
+ add_daemon mfscgiserv
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping MooseFS CGI Web Frontend Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon mfscgiserv
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/mfs/mfschunkserver b/src/mfs/mfschunkserver
new file mode 100755
index 0000000..606d00f
--- /dev/null
+++ b/src/mfs/mfschunkserver
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/mfschunkserver`
+case "$1" in
+ start)
+ stat_busy "Starting MooseFS Chunkserver Daemon"
+ if [ -z "$PID" ]; then
+ /usr/bin/mfschunkserver start
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ PID=`pidof -o %PPID /usr/bin/mfschunkserver`
+ echo $PID > /var/run/mfsmetalogger.pid
+ add_daemon mfschunkserver
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping MooseFS Chunkserver Daemon"
+ [ ! -z "$PID" ] && /usr/bin/mfschunkserver stop &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon mfschunkserver
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/mfs/mfsmaster b/src/mfs/mfsmaster
new file mode 100755
index 0000000..b0cfd82
--- /dev/null
+++ b/src/mfs/mfsmaster
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID -x /usr/bin/mfsmaster`
+case "$1" in
+ start)
+ stat_busy "Starting MooseFS Master Daemon"
+ if [ -z "$PID" ]; then
+ /usr/bin/mfsmaster start
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ PID=`pidof -o %PPID -x /usr/bin/mfsmaster`
+ echo $PID > /var/run/mfsmaster.pid
+ add_daemon mfsmaster
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping MooseFS Master Daemon"
+ [ ! -z "$PID" ] && /usr/bin/mfsmaster stop &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon mfsmaster
+ rm /var/run/mfsmaster.pid
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/mfs/mfsmetalogger b/src/mfs/mfsmetalogger
new file mode 100755
index 0000000..a870cc5
--- /dev/null
+++ b/src/mfs/mfsmetalogger
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/mfsmetalogger`
+case "$1" in
+ start)
+ stat_busy "Starting MooseFS Metalogger Daemon"
+ if [ -z "$PID" ]; then
+ /usr/bin/mfsmetalogger start
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ PID=`pidof -o %PPID /usr/bin/mfsmetalogger`
+ echo $PID > /var/run/mfsmetalogger.pid
+ add_daemon mfsmetalogger
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping MooseFS Metalogger Daemon"
+ [ ! -z "$PID" ] && /usr/bin/mfsmetalogger stop &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon mfsmetalogger
+ rm /var/run/mfsmetalogger.pid
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/minbif/minbif b/src/minbif/minbif
new file mode 100755
index 0000000..47888d1
--- /dev/null
+++ b/src/minbif/minbif
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/minbif`
+case "$1" in
+ start)
+ stat_busy "Starting minbif daemon"
+ if [ -z "$PID" ]; then
+ if [ ! -d /var/run/minbif ]; then
+ mkdir -p /var/run/minbif && chown minbif:minbif /var/run/minbif
+ fi
+ [ -f /var/run/minbif/minbif.pid ] && rm -f /var/run/minbif/minbif.pid
+ CMD='/usr/bin/minbif --pidfile /var/run/minbif/minbif.pid \
+ /etc/minbif/minbif.conf'
+ su -s /bin/sh -c "$CMD" minbif
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon minbif
+ stat_done
+ fi
+ else
+ stat_fail
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping minbif daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /var/run/minbif/minbif.pid
+ rm_daemon minbif
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/minidlna/minidlna.rc b/src/minidlna/minidlna.rc
new file mode 100755
index 0000000..dd59105
--- /dev/null
+++ b/src/minidlna/minidlna.rc
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/minidlna
+. /etc/minidlna.conf
+
+daemon_name=minidlna
+
+get_pid() {
+ pidof -o %PPID /usr/sbin/minidlna
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting minidlna"
+ PID=$(get_pid)
+ if [[ -z "$PID" ]]; then
+ rm -f /var/run/$daemon_name.pid
+ touch /var/run/$daemon_name.pid && chown $MINIDLNA_USER:$MINIDLNA_USER /var/run/$daemon_name.pid
+ mkdir -p /var/cache/minidlna
+ chown -R $MINIDLNA_USER /var/cache/minidlna
+ su -s /bin/sh -l -c "/usr/sbin/minidlna ${MINIDLNA_OPTS} $2" - $MINIDLNA_USER
+ if [[ $? -gt 0 ]]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping minidlna"
+ PID=$(get_pid)
+ [[ -n $PID ]] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/$daemon_name.pid &> /dev/null
+ rm_daemon minidlna
+ stat_done
+ fi
+ ;;
+
+ clean)
+ $0 stop
+ sleep 1
+ stat_busy "Cleaning minidlna cache"
+ [ -z $db_dir ] || rm -r $db_dir/*
+ stat_done
+ sleep 1
+ $0 start
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ rescan)
+ $0 stop
+ sleep 1
+ $0 start -R
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|clean}"
+esac
+exit 0
diff --git a/src/miredo/isatapd.rc.d b/src/miredo/isatapd.rc.d
new file mode 100755
index 0000000..fa7bbd7
--- /dev/null
+++ b/src/miredo/isatapd.rc.d
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/isatapd`
+case "$1" in
+ start)
+ stat_busy "Starting userspace ISATAP client"
+ if [ -z "$PID" ]; then
+ /usr/sbin/isatapd
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon isatapd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping userspace ISATAP client"
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon isatapd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/miredo/miredo-server.rc.d b/src/miredo/miredo-server.rc.d
new file mode 100755
index 0000000..d05513b
--- /dev/null
+++ b/src/miredo/miredo-server.rc.d
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/miredo-server`
+case "$1" in
+ start)
+ stat_busy "Starting teredo protocol server"
+ if [ -z "$PID" ]; then
+ /usr/sbin/miredo-server
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon miredo-server
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping teredo protocol server"
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon miredo-server
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/miredo/miredo.rc.d b/src/miredo/miredo.rc.d
new file mode 100755
index 0000000..500374b
--- /dev/null
+++ b/src/miredo/miredo.rc.d
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/miredo`
+case "$1" in
+ start)
+ stat_busy "Starting teredo protocol client"
+ if [ -z "$PID" ]; then
+ /usr/sbin/miredo
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon miredo
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping teredo protocol client"
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon miredo
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/misdnuser/misdncapid.rc b/src/misdnuser/misdncapid.rc
new file mode 100755
index 0000000..5c47ca0
--- /dev/null
+++ b/src/misdnuser/misdncapid.rc
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID="$(pidof -o %PPID /usr/sbin/mISDNcapid)"
+case "$1" in
+ start)
+ stat_busy "Starting misdncapid"
+ if [ ! -x /var/run/mISDNcapid ] ; then
+ install -m755 -d /var/run/mISDNcapid
+ fi
+
+ [ -z "$PID" ] && /usr/sbin/mISDNcapid >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ PID=$(pidof -o %PPID /usr/sbin/mISDNcapid)
+ echo $PID > /var/run/misdncapid.pid
+ add_daemon misdncapid
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping misdncapid"
+ [ -f /var/run/misdncapid.pid ] && kill `cat /var/run/misdncapid.pid` >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /var/run/misdncapid.pid
+ rm_daemon misdncapid
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/src/mongodb/mongodb.rc b/src/mongodb/mongodb.rc
new file mode 100755
index 0000000..30f2bbf
--- /dev/null
+++ b/src/mongodb/mongodb.rc
@@ -0,0 +1,39 @@
+#!/bin/bash
+# vim: syntax=sh
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=$(pidof /usr/bin/mongod)
+case "$1" in
+ start)
+ stat_busy "Starting mongodb"
+ [ -z "$PID" ] && /bin/su mongodb -c "/usr/bin/mongod --config /etc/mongodb.conf --fork" > /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon mongodb
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping mongodb"
+ [ ! -z "$PID" ] && /bin/su mongodb -c "/usr/bin/mongod --config /etc/mongodb.conf --shutdown" &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon mongodb
+ while [ ! -z "$(pidof /usr/bin/mongod)" ]; do
+ sleep 1;
+ done
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/monit/monitd b/src/monit/monitd
new file mode 100755
index 0000000..61a3597
--- /dev/null
+++ b/src/monit/monitd
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+start() {
+ stat_busy "Starting Monit"
+ /usr/bin/monit &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon monitd
+ stat_done
+ fi
+}
+
+stop() {
+ stat_busy "Stopping Monit"
+ /usr/bin/monit quit &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon monitd
+ stat_done
+ fi
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/motion/rc.motion b/src/motion/rc.motion
new file mode 100755
index 0000000..5b4c655
--- /dev/null
+++ b/src/motion/rc.motion
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/motion`
+case "$1" in
+ start)
+ stat_busy "Starting Motion"
+ mkdir -p /var/run/motion
+ [ -z "$PID" ] && /usr/bin/motion 1>/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon motion
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Motion"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon motion
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/mpd/rc.d b/src/mpd/rc.d
new file mode 100755
index 0000000..f00e160
--- /dev/null
+++ b/src/mpd/rc.d
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy 'Starting Music Player Daemon'
+ /usr/bin/mpd /etc/mpd.conf &> /dev/null &&
+ { add_daemon mpd; stat_done; } || stat_fail
+ ;;
+ stop)
+ stat_busy 'Stopping Music Player Daemon'
+ /usr/bin/mpd --kill /etc/mpd.conf &> /dev/null &&
+ { rm_daemon mpd; stat_done; } || stat_fail
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/mpdscribble/rc.d b/src/mpdscribble/rc.d
new file mode 100755
index 0000000..8071c0d
--- /dev/null
+++ b/src/mpdscribble/rc.d
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/mpdscribble`
+case "$1" in
+ start)
+ stat_busy "Starting mpdscribble"
+ [ -z "$PID" ] && /usr/bin/mpdscribble &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo $PID > /var/run/mpdscribble.pid
+ add_daemon mpdscribble
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping mpdscribble"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm /var/run/mpdscribble.pid
+ rm_daemon mpdscribble
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/multipath-tools/rc.d b/src/multipath-tools/rc.d
new file mode 100755
index 0000000..7f5ef5d
--- /dev/null
+++ b/src/multipath-tools/rc.d
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting multipathd"
+ /usr/bin/multipathd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon multipathd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping multipathd"
+ [ -f /var/run/multipathd.pid ] && kill `cat /var/run/multipathd.pid` >/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon multipathd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/munin/munin-node.init b/src/munin/munin-node.init
new file mode 100755
index 0000000..39bc95b
--- /dev/null
+++ b/src/munin/munin-node.init
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID munin-node`
+# set the path to prevent insecure path warnings from perl -T
+PATH='/bin:/usr/bin:/sbin:/usr/sbin'
+
+case "$1" in
+ start)
+ stat_busy "Starting munin-node"
+ [ -d /var/run/munin ] || mkdir -p /var/run/munin
+ munin-node >/dev/null
+ stat_done
+ add_daemon munin-node
+ ;;
+ stop)
+ stat_busy "Stopping munin-node"
+ if [ ! -z "$PID" ]; then
+ kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ stat_done
+ rm_daemon munin-node
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
diff --git a/src/murmur/murmur.rc.d b/src/murmur/murmur.rc.d
new file mode 100755
index 0000000..e26a2a3
--- /dev/null
+++ b/src/murmur/murmur.rc.d
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+CONF=/etc/conf.d/murmur
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+[ -f $CONF ] && . $CONF
+
+PID=$(pidof -o %PPID /usr/sbin/murmurd)
+case "$1" in
+ start)
+ stat_busy "Starting murmur"
+
+ [ -d /var/run/murmur ] || mkdir -p /var/run/murmur
+ chown murmur:murmur /var/run/murmur
+
+ [ -z "$PID" ] && /usr/sbin/murmurd $PARAMS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon murmur
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping murmur"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon murmur
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/mysql/mysqld.rc b/src/mysql/mysqld.rc
new file mode 100755
index 0000000..4bbddb5
--- /dev/null
+++ b/src/mysql/mysqld.rc
@@ -0,0 +1,77 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+getPID() {
+ echo $(pgrep -u mysql mysqld 2>/dev/null);
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting MySQL Server"
+ [ ! -d /run/mysqld ] && install -d -g mysql -o mysql /run/mysqld &>/dev/null
+ if [ -z "$(getPID)" ]; then
+ /usr/bin/mysqld_safe --user=mysql &>/dev/null &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ timeo=30
+ while [ $timeo -gt 0 ]; do
+ response=`/usr/bin/mysqladmin -uUNKNOWN_USER ping 2>&1` && break
+ echo "$response" | grep -q "mysqld is alive" && break
+ sleep 1
+ let timeo=${timeo}-1
+ done
+ if [ $timeo -eq 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo $(getPID) > /run/mysqld/mysqld.pid
+ add_daemon mysqld
+ stat_done
+ fi
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping MySQL Server"
+ if [ ! -z "$(getPID)" ]; then
+ timeo=30
+ kill $(getPID) &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ fi
+ while [ ! -z "$(getPID)" -a $timeo -gt 0 ]; do
+ sleep 1
+ let timeo=${timeo}-1
+ done
+ if [ -z "$(getPID)" ]; then
+ rm -f /run/mysqld/mysqld.pid &>/dev/null
+ rm_daemon mysqld
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/mythplugins/mtd.rc b/src/mythplugins/mtd.rc
new file mode 100755
index 0000000..1f46dfe
--- /dev/null
+++ b/src/mythplugins/mtd.rc
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/mtd`
+case "$1" in
+ start)
+ stat_busy "Starting Myth Transcoding Daemon"
+ [ -z "$PID" ] && /usr/bin/mtd -d
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo $PID > /var/run/mtd.pid
+ add_daemon mythtranscode
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Myth Transcoding Daemon"
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon mtd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/mythtv/mythbackend.rc b/src/mythtv/mythbackend.rc
new file mode 100755
index 0000000..488b4cb
--- /dev/null
+++ b/src/mythtv/mythbackend.rc
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/profile
+
+###############################################################################
+# Default values to use if none are supplied in the config file.
+#
+# User who should start the mythbackend process
+MBE_USER='mythtv'
+
+# Startup options for mythbackend
+MBE_OPTS=''
+
+# Directory holding the mythbackend log file
+LOG_PATH='/var/log/mythtv'
+
+# Logging options for mythbackend
+LOG_OPTS=''
+###############################################################################
+
+CONFIG_FILE=/etc/conf.d/mythbackend
+PIDFILE=/var/run/mythbackend.pid
+
+if [[ -r "$CONFIG_FILE" ]]; then
+ . "$CONFIG_FILE"
+fi
+
+PID="$(cat "$PIDFILE" 2> /dev/null || pidof mythbackend)"
+export HOME="$(getent passwd "$MBE_USER" | cut -d : -f 6)"
+
+case "$1" in
+ start)
+ stat_busy "Starting MythTV Backend"
+
+ if [[ "$PID" -gt 0 ]] && kill -0 "$PID"; then
+ stat_fail
+ exit 0
+ fi
+
+ touch "$PIDFILE"
+ chown "$MBE_USER" "$PIDFILE" "$LOG_PATH"
+
+ MBE_CMD="/usr/bin/mythbackend --daemon \
+ --logpath "$LOG_PATH" $LOG_OPTS \
+ --pidfile "$PIDFILE" $MBE_OPTS"
+ if su "$MBE_USER" -c "$MBE_CMD"; then
+ add_daemon mythbackend
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping MythTV Backend"
+ if [[ "$PID" -gt 0 ]] && kill "$PID" &> /dev/null; then
+ rm_daemon mythbackend
+ stat_done
+ rm -f "$PIDFILE"
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ "$0" stop
+ "$0" start
+ ;;
+ *)
+ echo "usage: $0 (start|stop|restart)"
+ ;;
+esac
+exit 0
diff --git a/src/nbd/nbd b/src/nbd/nbd
new file mode 100755
index 0000000..76d16c7
--- /dev/null
+++ b/src/nbd/nbd
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PIDFILE="/var/run/nbd-server.pid"
+PID=`cat $PIDFILE 2>/dev/null`
+case "$1" in
+ start)
+ stat_busy "Starting Network Block Device Server"
+ if [ "$PID" = "" ]; then
+ /usr/bin/nbd-server
+ fi
+ if [ "$PID" != "" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon nbd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Network Block Device Server"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ rm -f $PIDFILE
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon nbd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/ndisc6/rdnssd.rc.d b/src/ndisc6/rdnssd.rc.d
new file mode 100755
index 0000000..3c0a6a5
--- /dev/null
+++ b/src/ndisc6/rdnssd.rc.d
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/rdnssd
+
+PIDFILE="/var/run/rdnssd.pid"
+PID=`cat "$PIDFILE" 2>/dev/null`
+case "$1" in
+ start)
+ stat_busy "Starting RDNSS Daemon"
+ if [ ! -z "$PID" -a -e "/proc/$PID" ]; then
+ stat_append "-- Already running"
+ stat_die
+ else
+ /usr/sbin/rdnssd -p "$PIDFILE" \
+ ${MERGEHOOK/*/-H} "$MERGEHOOK" \
+ ${RUN_AS/*/-u} "$RUN_AS"
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon rdnssd
+ stat_done
+ fi
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping RDNSS Daemon"
+ if [ -z "$PID" ]; then
+ stat_append "-- Not running"
+ stat_die
+ else
+ kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon sshd
+ stat_done
+ fi
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/net-snmp/snmpd.rc b/src/net-snmp/snmpd.rc
new file mode 100755
index 0000000..b00c09f
--- /dev/null
+++ b/src/net-snmp/snmpd.rc
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/snmpd
+
+PID=`pidof -o %PPID /usr/sbin/snmpd`
+case "$1" in
+ start)
+ stat_busy "Starting Net-SNMP"
+ [ -z "$PID" ] && /usr/sbin/snmpd $SNMPD_ARGS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo $PID > /var/run/snmpd.pid
+ add_daemon snmpd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Net-SNMP"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm /var/run/snmpd.pid
+ rm_daemon snmpd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/netperf/netperf.rc b/src/netperf/netperf.rc
new file mode 100755
index 0000000..f2a2de5
--- /dev/null
+++ b/src/netperf/netperf.rc
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+DAEMON=/usr/bin/netserver
+PID=$(pidof -o %PPID $DAEMON)
+
+case "$1" in
+ start)
+ stat_busy "Starting ${0##*/} daemon"
+ [[ ! $PID ]] &&
+ </dev/null &>/dev/null $DAEMON $DAEMON_OPTS &&
+ add_daemon ${0##*/} &&
+ stat_done &&
+ exit 0
+ stat_fail
+ ;;
+ stop)
+ stat_busy "Stopping ${0##*/} daemon"
+ [[ $PID ]] &&
+ kill $PID &> /dev/null &&
+ rm_daemon ${0##*/} &&
+ stat_done &&
+ exit 0
+ stat_fail
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit 0
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ ;;
+esac
+
+exit 1
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/nfs-utils/nfs-common b/src/nfs-utils/nfs-common
new file mode 100755
index 0000000..7b16b4b
--- /dev/null
+++ b/src/nfs-utils/nfs-common
@@ -0,0 +1,315 @@
+#!/bin/bash
+
+daemon_name=nfs-common
+
+NEED_STATD=
+STATD_OPTS=
+NEED_IDMAPD=
+IDMAPD_OPTS=
+NEED_GSSD=
+GSSD_OPTS=
+PIPEFS_MOUNTPOINT=
+PIPEFS_MOUNTOPTS=
+
+# rpc.statd daemon & binary location
+STATD_DAEMON_NAME=rpc.statd
+STATD="/usr/sbin/rpc.statd"
+
+# rpc.idmapd daemon & binary location
+IDMAPD_DAEMON_NAME=rpc.idmapd
+IDMAPD="/usr/sbin/rpc.idmapd"
+
+# rpc.gssd daemon & binary location
+GSSD_DAEMON_NAME=rpc.gssd
+GSSD="/usr/sbin/rpc.gssd"
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/$daemon_name.conf
+
+# Default mountpoint and options for rpc_pipefs filesystem
+[ -z "$PIPEFS_MOUNTPOINT" ] && PIPEFS_MOUNTPOINT="/var/lib/nfs/rpc_pipefs"
+[ -z "$PIPEFS_MOUNTOPTS" ] && PIPEFS_MOUNTOPTS="defaults"
+
+# Parse the fstab file, and determine whether we need idmapd and gssd. (The
+# /etc/conf.d/nfs-common settings, if any, will override our autodetection.)
+AUTO_NEED_IDMAPD=no
+AUTO_NEED_GSSD=no
+
+if [ -f /etc/fstab ]; then
+ exec 9<&0 </etc/fstab
+
+ while read DEV MTPT FSTYPE OPTS REST; do
+ if [ "$FSTYPE" = "nfs4" ]; then
+ AUTO_NEED_IDMAPD=yes
+ fi
+ case "$OPTS" in
+ sec=krb5|*,sec=krb5|sec=krb5,*|*,sec=krb5i,*|sec=krb5i|*,sec=krb5i|sec=krb5i,*|*,sec=krb5i,*|sec=krb5p|*,sec=krb5p|sec=krb5p,*|*,sec=krb5p,*)
+ AUTO_NEED_GSSD=yes
+ ;;
+ esac
+ done
+
+ exec 0<&9 9<&-
+fi
+
+# We also need idmapd if we run an NFSv4 server. It's fairly difficult
+# to autodetect whether there are NFSv4 exports or not, and idmapd is not a
+# particularily heavy daemon, so we auto-enable it if we find an /etc/exports
+# file. This does not mean that there are NFSv4 or other mounts active (or
+# even that nfs-kernel-server is installed), but it matches what the "start"
+# condition in nfs-kernel-server's init script does, which has a value in
+# itself.
+if [ -f /etc/exports ] && grep -q '^[[:space:]]*[^#]*/' /etc/exports; then
+ AUTO_NEED_IDMAPD=yes
+fi
+
+case "$NEED_STATD" in
+ yes|no)
+ ;;
+ *)
+ NEED_STATD=yes
+ ;;
+esac
+
+case "$NEED_IDMAPD" in
+ yes|no)
+ ;;
+ *)
+ NEED_IDMAPD=$AUTO_NEED_IDMAPD
+ ;;
+esac
+
+case "$NEED_GSSD" in
+ yes|no)
+ ;;
+ *)
+ NEED_GSSD=$AUTO_NEED_GSSD
+ ;;
+esac
+
+do_modprobe() {
+ if [ -x /sbin/modprobe -a -f /proc/modules ]; then
+ modprobe -q "$1" || true
+ fi
+}
+
+do_mount() {
+ if ! grep -E "$1\$" /proc/filesystems &> /dev/null ; then
+ return 1
+ fi
+
+ if grep -vw "$1" /proc/mounts &> /dev/null ; then
+ if ! mountpoint -q "$2" ; then
+ mount -t "$1" "$1" "$2" -o "$3"
+ return
+ fi
+ fi
+ return 0
+}
+
+do_umount() {
+ if mountpoint -q "$1" ; then
+ umount "$1"
+ fi
+ return 0
+}
+
+get_pid() {
+ pidof -o %PPID "$1"
+}
+
+case "$1" in
+ start)
+ ck_daemon rpcbind && { echo -n "Start rpcbind first." >&2; stat_die; }
+ rc=0
+ if [ "$NEED_STATD" = yes ]; then
+ stat_busy "Starting $STATD_DAEMON_NAME daemon"
+ PID=$(get_pid $STATD)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$STATD_DAEMON_NAME.pid ] && rm -f /var/run/$STATD_DAEMON_NAME.pid
+ # RUN
+ $STATD $STATD_OPTS
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ echo $(get_pid $STATD) > /var/run/$STATD_DAEMON_NAME.pid
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ # Run sm-notify
+ /usr/sbin/sm-notify $SMNOTIFY_OPTS
+ fi
+
+ if [ "$NEED_IDMAPD" = yes ] || [ "$NEED_GSSD" = yes ]; then
+ stat_busy "Mounting pipefs filesystem"
+ do_modprobe sunrpc
+ do_modprobe nfs
+ do_modprobe nfsd
+ do_mount rpc_pipefs "$PIPEFS_MOUNTPOINT" "$PIPEFS_MOUNTOPTS"
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ stat_done
+ fi
+
+ if [ "$NEED_IDMAPD" = yes ]; then
+ stat_busy "Starting $IDMAPD_DAEMON_NAME daemon"
+ PID=$(get_pid $IDMAPD)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$IDMAPD_DAEMON_NAME.pid ] && rm -f /var/run/$IDMAPD_DAEMON_NAME.pid
+ # RUN
+ $IDMAPD $IDMAPD_OPTS
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ echo $(get_pid $IDMAPD) > /var/run/$IDMAPD_DAEMON_NAME.pid
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ fi
+
+ if [ "$NEED_GSSD" = yes ]; then
+ do_modprobe rpcsec_gss_krb5
+ stat_busy "Starting $GSSD_DAEMON_NAME daemon"
+ PID=$(get_pid $GSSD)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$GSSD_DAEMON_NAME.pid ] && rm -f /var/run/$GSSD_DAEMON_NAME.pid
+ # RUN
+ $GSSD $GSSD_OPTS
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ echo $(get_pid $GSSD) > /var/run/$GSSD_DAEMON_NAME.pid
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ fi
+ fi
+
+ add_daemon $daemon_name
+ ;;
+
+ stop)
+ rc=0
+ if [ "$NEED_IDMAPD" = yes ] || [ "$NEED_GSSD" = yes ]; then
+
+ if [ "$NEED_GSSD" = yes ]; then
+ stat_busy "Stopping $GSSD_DAEMON_NAME daemon"
+ PID=$(get_pid $GSSD)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ rm -f /var/run/$GSSD_DAEMON_NAME.pid &> /dev/null
+ stat_done
+ fi
+ fi
+
+ if [ "$NEED_IDMAPD" = yes ]; then
+ stat_busy "Stopping $IDMAPD_DAEMON_NAME daemon"
+ PID=$(get_pid $IDMAPD)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ rm -f /var/run/$IDMAPD_DAEMON_NAME.pid &> /dev/null
+ stat_done
+ fi
+ fi
+ do_umount "$PIPEFS_MOUNTPOINT" 2>/dev/null || true
+ fi
+
+ if [ "$NEED_STATD" = yes ]; then
+ stat_busy "Stopping $STATD_DAEMON_NAME daemon"
+ PID=$(get_pid $STATD)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ rm -f /var/run/$STATD_DAEMON_NAME.pid &> /dev/null
+ stat_done
+ fi
+ fi
+
+ rm_daemon $daemon_name
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+
+ if [ "$NEED_STATD" = yes ]; then
+ stat_busy "Daemon $STATD_DAEMON_NAME running"
+ PID=$(get_pid $STATD)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ fi
+
+ if [ "$NEED_GSSD" = yes ]; then
+ stat_busy "Daemon $GSSD_DAEMON_NAME running"
+ PID=$(get_pid $GSSD)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ fi
+
+ if [ "$NEED_IDMAPD" = yes ]; then
+ stat_busy "Daemon $IDMAPD_DAEMON_NAME running"
+ PID=$(get_pid $IDMAPD)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ fi
+ echo
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|status|restart}"
+esac
+exit 0
+
diff --git a/src/nfs-utils/nfs-server b/src/nfs-utils/nfs-server
new file mode 100755
index 0000000..6aa609d
--- /dev/null
+++ b/src/nfs-utils/nfs-server
@@ -0,0 +1,299 @@
+#!/bin/bash
+
+daemon_name=nfs-server
+
+NFSD_COUNT=
+NFSD_OPTS=
+NEED_SVCGSSD=
+SVCGSSD_OPTS=
+MOUNTD_OPTS=
+PROCNFSD_MOUNTPOINT=
+PROCNFSD_MOUNTOPTS=
+
+# rpc.nfsd daemon & binary location
+NFSD_PROCESS_NAME=nfsd
+NFSD_DAEMON_NAME=rpc.nfsd
+NFSD="/usr/sbin/rpc.nfsd"
+
+# rpc.svcgssd daemon & binary location
+SVCGSSD_DAEMON_NAME=rpc.svcgssd
+SVCGSSD="/usr/sbin/rpc.svcgssd"
+
+# rpc.idmapd daemon & binary location
+IDMAPD_DAEMON_NAME=rpc.idmapd
+IDMAPD="/usr/sbin/rpc.idmapd"
+
+# rpc.mountd daemon & binary location
+MOUNTD_DAEMON_NAME=rpc.mountd
+MOUNTD="/usr/sbin/rpc.mountd"
+
+# exortfs binary location
+EXPORTFS="/usr/sbin/exportfs"
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/$daemon_name.conf
+
+# Default number of nfsd servers
+[ -z "$NFSD_COUNT" ] && NFSD_COUNT=8
+
+# Default mountpoint and options for nfsd filesystem
+[ -z "$PROCNFSD_MOUNTPOINT" ] && PROCNFSD_MOUNTPOINT="/proc/fs/nfsd"
+[ -z "$PROCNFSD_MOUNTOPTS" ] && PROCNFSD_MOUNTOPTS="rw,nodev,noexec,nosuid"
+
+case "$NEED_SVCGSSD" in
+ yes|no)
+ ;;
+ *)
+ NEED_SVCGSSD=no
+ ;;
+esac
+
+do_modprobe() {
+ if [ -x /sbin/modprobe -a -f /proc/modules ]; then
+ modprobe -q "$1" || true
+ fi
+}
+
+do_mount() {
+ if ! grep -E "$1\$" /proc/filesystems &> /dev/null ; then
+ return 1
+ fi
+
+ if grep -vw "$1" /proc/mounts &> /dev/null ; then
+ if ! mountpoint -q "$2" ; then
+ mount -t "$1" "$1" "$2" -o "$3"
+ return
+ fi
+ fi
+ return 0
+}
+
+do_umount() {
+ if mountpoint -q "$1" ; then
+ umount "$1"
+ fi
+ return 0
+}
+
+get_pid() {
+ pidof -o %PPID "$1"
+}
+
+case "$1" in
+ start)
+ ck_daemon nfs-common && { echo -n "Start nfs-common first." >&2; stat_die; }
+ rc=0
+ stat_busy "Mounting nfsd filesystem"
+ do_modprobe nfsd
+ do_mount nfsd "$PROCNFSD_MOUNTPOINT" "$PROCNFSD_MOUNTOPTS"
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ stat_done
+ fi
+
+ stat_busy "Exporting all directories"
+ $EXPORTFS -r
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ stat_done
+ fi
+
+ stat_busy "Starting $NFSD_DAEMON_NAME daemon"
+ PID=$(get_pid $NFSD_PROCESS_NAME)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$NFSD_DAEMON_NAME.pid ] && rm -f /var/run/$NFSD_DAEMON_NAME.pid
+ # RUN
+ $NFSD $NFSD_OPTS $NFSD_COUNT
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ echo $(get_pid $NFSD_PROCESS_NAME) > /var/run/$NFSD_DAEMON_NAME.pid
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+
+ if [ "$NEED_SVCGSSD" = yes ]; then
+ do_modprobe rpcsec_gss_krb5
+ stat_busy "Starting $SVCGSSD_DAEMON_NAME daemon"
+ PID=$(get_pid $SVCGSSD)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$SVCGSSD_DAEMON_NAME.pid ] && rm -f /var/run/$SVCGSSD_DAEMON_NAME.pid
+ # RUN
+ $SVCGSSD $SVCGSSD_OPTS
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ echo $(get_pid $SVCGSSD) > /var/run/$SVCGSSD_DAEMON_NAME.pid
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ fi
+
+ PID=$(get_pid $IDMAPD)
+ [ ! -z "$PID" ] && kill -SIGHUP $IDMAPD_DAEMON_NAME &> /dev/null
+
+ stat_busy "Starting $MOUNTD_DAEMON_NAME daemon"
+ PID=$(get_pid $MOUNTD)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$MOUNTD_DAEMON_NAME.pid ] && rm -f /var/run/$MOUNTD_DAEMON_NAME.pid
+ # RUN
+ $MOUNTD $MOUNTD_OPTS
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ echo $(get_pid $MOUNTD) > /var/run/$MOUNTD_DAEMON_NAME.pid
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+
+ add_daemon $daemon_name
+ ;;
+
+ stop)
+ rc=0
+ stat_busy "Stopping $MOUNTD_DAEMON_NAME daemon"
+ PID=$(get_pid $MOUNTD)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ rm -f /var/run/$MOUNTD_DAEMON_NAME.pid &> /dev/null
+ stat_done
+ fi
+
+ if [ "$NEED_SVCGSSD" = yes ]; then
+ stat_busy "Stopping $SVCGSSD_DAEMON_NAME daemon"
+ PID=$(get_pid $SVCGSSD)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ rm -f /var/run/$SVCGSSD_DAEMON_NAME.pid &> /dev/null
+ stat_done
+ fi
+ fi
+
+ stat_busy "Stopping $NFSD_DAEMON_NAME daemon"
+ PID=$(get_pid $NFSD_PROCESS_NAME)
+ # KILL (SIGINT)
+ [ ! -z "$PID" ] && kill -2 $PID &> /dev/null
+ #
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ sleep 1
+ PID=$(get_pid $NFSD_PROCESS_NAME)
+ # KILL (KILL) - just to be sure
+ [ ! -z "$PID" ] && kill -9 $PID &> /dev/null
+ #
+ rm -f /var/run/$NFSD_DAEMON_NAME.pid &> /dev/null
+ stat_done
+ fi
+
+ stat_busy "Unexporting all directories"
+ $EXPORTFS -au
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ stat_done
+ fi
+
+ # flush everything out of the kernels export table
+ if mountpoint -q "$PROCNFSD_MOUNTPOINT" ; then
+ $EXPORTFS -f
+ fi
+ do_umount "$PROCNFSD_MOUNTPOINT" 2>/dev/null || true
+ rm_daemon $daemon_name
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+
+ stat_busy "Daemon $NFSD_DAEMON_NAME running"
+ PID=$(get_pid $NFSD_PROCESS_NAME)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+
+ stat_busy "Daemon $MOUNTD_DAEMON_NAME running"
+ PID=$(get_pid $MOUNTD)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+
+ if [ "$NEED_SVCGSSD" = yes ]; then
+ stat_busy "Daemon $SVCGSSD_DAEMON_NAME running"
+ PID=$(get_pid $SVCGSSD)
+ if [ -z "$PID" ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ fi
+ echo
+ ;;
+
+ reload)
+ rc=0
+ stat_busy "Re-exporting all directories"
+ $EXPORTFS -r
+ rc=$(($rc+$?))
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ exit $rc
+ else
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|status|reload|restart}"
+esac
+exit 0
diff --git a/src/nginx/rc.d b/src/nginx/rc.d
new file mode 100755
index 0000000..eb9031e
--- /dev/null
+++ b/src/nginx/rc.d
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+function check_config {
+ stat_busy "Checking nginx configuration"
+ /usr/sbin/nginx -t -q -c /etc/nginx/nginx.conf
+ if [ $? -ne 0 ]; then
+ stat_die
+ else
+ stat_done
+ fi
+}
+
+case "$1" in
+ start)
+ check_config
+ $0 careless_start
+ ;;
+ careless_start)
+ stat_busy "Starting nginx"
+ if [ -s /var/run/nginx.pid ]; then
+ stat_fail
+ # probably ;)
+ stat_busy "Nginx is already running"
+ stat_die
+ fi
+ /usr/sbin/nginx -c /etc/nginx/nginx.conf &>/dev/null
+ if [ $? -ne 0 ]; then
+ stat_fail
+ else
+ add_daemon nginx
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping nginx"
+ PID=$(cat /var/run/nginx.pid)
+ kill -QUIT $PID &>/dev/null
+ if [ $? -ne 0 ]; then
+ stat_fail
+ else
+ for i in {1..10}; do
+ [ -d /proc/$PID ] || { stat_done; rm_daemon nginx; exit 0; }
+ sleep 1
+ done
+ stat_fail
+ fi
+ ;;
+ restart)
+ check_config
+ $0 stop
+ sleep 1
+ $0 careless_start
+ ;;
+ reload)
+ check_config
+ if [ -s /var/run/nginx.pid ]; then
+ status "Reloading nginx configuration" kill -HUP $(cat /var/run/nginx.pid)
+ fi
+ ;;
+ check)
+ check_config
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|reload|check|careless_start}"
+esac
diff --git a/src/ngircd/ngircd.sh b/src/ngircd/ngircd.sh
new file mode 100755
index 0000000..3947f52
--- /dev/null
+++ b/src/ngircd/ngircd.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting ngircd IRC daemon"
+ /usr/sbin/ngircd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ add_daemon ngircd
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ngircd IRC daemon"
+ PID=`pidof -o %PPID /usr/sbin/ngircd`
+ kill $PID > /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ngircd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/noip/noip-rc.d b/src/noip/noip-rc.d
new file mode 100755
index 0000000..c40b9d1
--- /dev/null
+++ b/src/noip/noip-rc.d
@@ -0,0 +1,39 @@
+#!/bin/bash
+_DAEMON=noip
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/${_DAEMON}2`
+case "$1" in
+ start)
+ stat_busy "Starting $_DAEMON"
+ [ -z "$PID" ] && /usr/bin/${_DAEMON}2
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo `pidof -o %PPID /usr/bin/${_DAEMON}2` > /var/run/$_DAEMON.pid
+ add_daemon $_DAEMON
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping $_DAEMON"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /var/run/$_DAEMON.pid
+ rm_daemon $_DAEMON
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/ntop/ntop b/src/ntop/ntop
new file mode 100755
index 0000000..2f0dbcb
--- /dev/null
+++ b/src/ntop/ntop
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+# source application-specific settings
+[ -f /etc/conf.d/ntop ] && . /etc/conf.d/ntop
+
+case "$1" in
+ start)
+ stat_busy "Starting ntop daemon"
+ /usr/bin/ntop -d ${NTOP_ARGS} 2>&1 >> ${NTOP_LOG}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ntop
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ntop daemon"
+ killall /usr/bin/ntop &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ntop
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/ntp/ntpd b/src/ntp/ntpd
new file mode 100755
index 0000000..480fa10
--- /dev/null
+++ b/src/ntp/ntpd
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/ntpd.conf
+
+unset PID
+PIDFILE='/run/ntpd.pid'
+
+if [[ -r ${PIDFILE} ]]; then
+ read -r PID <"${PIDFILE}"
+ if [[ -n ${PID} && ! -d /proc/${PID} ]]; then
+ rm -f "${PIDFILE}"
+ unset PID
+ fi
+fi
+
+case "$1" in
+ start)
+ stat_busy "Starting NTP Daemon"
+ if [[ -z ${PID} ]] && /usr/bin/ntpd ${NTPD_ARGS} -p "${PIDFILE}" &>/dev/null; then
+ add_daemon ntpd
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping NTP Daemon"
+ if [[ -n ${PID} ]] && kill "${PID}" &>/dev/null; then
+ rm ${PIDFILE}
+ rm_daemon ntpd
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/ntp/ntpdate b/src/ntp/ntpdate
new file mode 100755
index 0000000..a8e7467
--- /dev/null
+++ b/src/ntp/ntpdate
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/ntpd.conf
+
+case "$1" in
+ start)
+ stat_busy "Starting NTP Client"
+ if /usr/bin/ntpd -q ${NTP_CLIENT_OPTION} &>/dev/null; then
+ add_daemon ntpdate
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping NTP Client"
+ rm_daemon ntpdate
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/oidentd/rc.d b/src/oidentd/rc.d
new file mode 100755
index 0000000..8b3c04c
--- /dev/null
+++ b/src/oidentd/rc.d
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/oidentd
+
+# no daemon check needed for oidentd, and no pid nesecary.
+case "$1" in
+ start)
+ stat_busy "Starting oidentd Daemon..."
+ # oidentd is smart enough to only run one copy of
+ # itsself, no check nesecary, and no pidfile
+ /usr/sbin/oidentd -u ${USER} -g ${GROUP} ${OPTS}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon oidentd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping oidentd Daemon..."
+ # kill the process by it's full name, or the init script
+ # will terminate as well, wreaking havok.
+ killall /usr/sbin/oidentd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon oidentd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/open-vm-tools/open-vm-tools.rc.d b/src/open-vm-tools/open-vm-tools.rc.d
new file mode 100755
index 0000000..1d9505a
--- /dev/null
+++ b/src/open-vm-tools/open-vm-tools.rc.d
@@ -0,0 +1,106 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+# source application-specific settings
+[ -f /etc/conf.d/open-vm-tools ] && . /etc/conf.d/open-vm-tools
+
+PID=`pidof -o %PPID /usr/bin/vmtoolsd`
+case "$1" in
+ start)
+ stat_busy "Starting Open Virtual Machine Tools"
+
+ if [ "$VM_DRAG_AND_DROP" == "yes" ]; then
+ VMBLOCK=`grep -w vmblock /proc/modules`
+ [ -z "$VMBLOCK" ] && modprobe vmblock
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ fi
+
+ DND_TMPDIR="/tmp/VMwareDnD"
+ if [ ! -d "$DND_TMPDIR" ]; then
+ mkdir $DND_TMPDIR
+ chmod 1777 $DND_TMPDIR
+ fi
+
+ mount -t vmblock none /proc/fs/vmblock/mountPoint
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ fi
+ fi
+
+
+ for m in ${VM_MODULES[@]}; do
+ VMMOD=`grep -w $m /proc/modules`
+ [ -z "$VMMOD" ] && \
+ { modprobe $m
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ fi; }
+ done
+
+
+ [ -z "$PID" ] && /usr/bin/vmtoolsd --background $PIDFILE
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon open-vm-tools
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Open Virtual Machine Tools"
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+# if [ $? -gt 0 ]; then
+# stat_fail
+# exit 1
+# fi
+
+ VM_MODULES_RM=()
+ for m in ${VM_MODULES[@]}; do
+ VM_MODULES_RM=($m ${VM_MODULES_RM[@]})
+ done
+
+ for m in ${VM_MODULES_RM[@]}; do
+ VMMOD=`grep -w $m /proc/modules`
+ [ ! -z "$VMMOD" ] && rmmod $m
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 4
+ fi
+ done
+
+ if [ "$VM_DRAG_AND_DROP" == "yes" ]; then
+ MOUNTPOINT=`grep -w "none /proc/fs/vmblock/mountPoint vmblock" /proc/modules`
+ [ -z "$MOUNTPOINT" ] && umount /proc/fs/vmblock/mountPoint
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 5
+ fi
+
+ DND_TMPDIR="/tmp/VMwareDnD"
+ rm -r $DND_TMPDIR
+
+ VMBLOCK=`grep -w vmblock /proc/modules`
+ [ ! -z "$VMBLOCK" ] && rmmod vmblock
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 6
+ fi
+ fi
+
+ rm_daemon open-vm-tools
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/opendkim/opendkim.rc b/src/opendkim/opendkim.rc
new file mode 100755
index 0000000..f87bfcf
--- /dev/null
+++ b/src/opendkim/opendkim.rc
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/opendkim
+
+PID=`pidof -o %PPID /usr/sbin/opendkim`
+case "$1" in
+ start)
+ stat_busy "Starting OpenDKIM filter"
+ if [ -z "$PID" ]; then
+ /usr/sbin/opendkim $OPENDKIM_FILTER > /dev/null &
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon dkim
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping OpenDKIM filter"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon dkim
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/openfire/openfire b/src/openfire/openfire
new file mode 100755
index 0000000..f260a71
--- /dev/null
+++ b/src/openfire/openfire
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/profile.d/jre.sh
+
+[ -f "/etc/conf.d/openfire" ] && . /etc/conf.d/openfire
+
+OPENFIRE_HOME="/usr/share/openfire"
+OPENFIRE_LOGDIR="/var/log/openfire"
+OPENFIRE_LIB="/usr/lib/openfire"
+
+OPENFIRE_RUN_CMD="java -server ${OPENFIRE_OPTS} -DopenfireHome=${OPENFIRE_HOME} -Dopenfire.lib.dir=${OPENFIRE_LIB} -classpath ${OPENFIRE_LIB}/startup.jar -jar ${OPENFIRE_LIB}/startup.jar"
+
+
+case "$1" in
+ start)
+ stat_busy "Starting Openfire Daemon"
+
+ rm -f $OPENFIRE_LOGDIR/nohup.out
+ su -s /bin/sh -c "nohup $OPENFIRE_RUN_CMD > $OPENFIRE_LOGDIR/nohup.out 2>&1 &" openfire
+ sleep 2
+
+ RETVAL=$?
+ PID=`ps ax --width=1000 | grep openfire | grep startup.jar | awk '{print $1}'`
+
+ if [ $RETVAL -eq 0 -a ! -z "$PID" ]; then
+ echo $PID > /var/run/openfire.pid
+
+ add_daemon openfire
+ sleep 2
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Openfire Daemon"
+
+ kill `cat /var/run/openfire.pid`
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /var/run/openfire.pid
+ rm_daemon openfire
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 10
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/openldap/slapd b/src/openldap/slapd
new file mode 100755
index 0000000..604f6b2
--- /dev/null
+++ b/src/openldap/slapd
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+[ -f "/etc/conf.d/slapd" ] && . /etc/conf.d/slapd
+
+PID=`pidof -o %PPID /usr/sbin/slapd`
+case "$1" in
+ start)
+ stat_busy "Starting OpenLDAP"
+ [ ! -d /run/openldap ] && install -d -m755 -o ldap -g ldap /run/openldap
+ if [ -z "$PID" ]; then
+ if [ -z "$SLAPD_SERVICES" ]; then
+ /usr/sbin/slapd -u ldap -g ldap $SLAPD_OPTIONS
+ else
+ /usr/sbin/slapd -u ldap -g ldap -h "$SLAPD_SERVICES" $SLAPD_OPTIONS
+ fi
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon slapd
+ stat_done
+ fi
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping OpenLDAP"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /run/openldap/slapd.pid
+ rm -f /run/openldap/slapd.args
+ rm_daemon slapd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/openntpd/openntpd b/src/openntpd/openntpd
new file mode 100755
index 0000000..59fa810
--- /dev/null
+++ b/src/openntpd/openntpd
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+CONF=/etc/conf.d/openntpd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+[[ -f $CONF ]] && . "$CONF"
+
+PID=$(pidof -o %PPID /usr/sbin/ntpd)
+case $1 in
+ start)
+ stat_busy "Starting OpenNTPD"
+ [[ -d /run/openntpd ]] || mkdir /run/openntpd
+ if [[ $PID ]] || ! /usr/sbin/ntpd $PARAMS; then
+ stat_fail
+ else
+ pidof -o %PPID /usr/sbin/ntpd >/run/openntpd.pid
+ add_daemon openntpd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping OpenNTPD"
+ if [[ -z $PID ]] || ! kill $PID &>/dev/null; then
+ stat_fail
+ else
+ rm_daemon openntpd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/opensips/opensips.init b/src/opensips/opensips.init
new file mode 100755
index 0000000..1c883c4
--- /dev/null
+++ b/src/opensips/opensips.init
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+BINNAME=opensips
+OSRDIR=/usr/sbin
+OPENSIPS=$OSRDIR/$BINNAME
+
+TMPDIR=/var/tmp
+CORE=$TMPDIR/core
+
+ETC=/etc/opensips/opensips.cfg
+PIDFILE=/var/run/opensips.pid
+
+case "$1" in
+ start)
+ stat_busy "Starting OpenSIPS server"
+ cd $TMPDIR
+ $OPENSIPS -f $ETC -w $TMPDIR -P $PIDFILE 2>&1 > /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon opensips
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping OpenSIPS server"
+ if [ -r $PIDFILE ]
+ then
+ cat $PIDFILE | xargs kill
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon opensips
+ stat_done
+ fi
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/openslp/rc.slpd b/src/openslp/rc.slpd
new file mode 100755
index 0000000..4330c37
--- /dev/null
+++ b/src/openslp/rc.slpd
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/slpd`
+case "$1" in
+ start)
+ stat_busy "Starting SLPD"
+ [ -z "$PID" ] && /usr/sbin/slpd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo $PID > /var/run/slpd.pid
+ add_daemon slpd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping SLPD"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm /var/run/slpd.pid
+ rm_daemon slpd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/openssh/sshd b/src/openssh/sshd
new file mode 100755
index 0000000..d60804e
--- /dev/null
+++ b/src/openssh/sshd
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/sshd
+
+PIDFILE=/run/sshd.pid
+PID=$(cat $PIDFILE 2>/dev/null)
+if ! readlink -q /proc/$PID/exe | grep -q '^/usr/sbin/sshd'; then
+ PID=
+ rm $PIDFILE 2>/dev/null
+fi
+
+case "$1" in
+ start)
+ stat_busy 'Starting Secure Shell Daemon'
+ /usr/bin/ssh-keygen -A
+ [[ -z $PID ]] && /usr/sbin/sshd $SSHD_ARGS
+ if [[ $? -gt 0 ]]; then
+ stat_fail
+ else
+ add_daemon sshd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy 'Stopping Secure Shell Daemon'
+ [[ ! -z $PID ]] && kill $PID &> /dev/null
+ if [[ $? -gt 0 ]]; then
+ stat_fail
+ else
+ rm_daemon sshd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/openssh/sshd-close-sessions b/src/openssh/sshd-close-sessions
new file mode 100755
index 0000000..be2a709
--- /dev/null
+++ b/src/openssh/sshd-close-sessions
@@ -0,0 +1,17 @@
+# Close sshd sessions before shutting down the network; see FS#17389.
+
+sshd_close_sessions () {
+ if ck_daemon sshd; then
+ return
+ fi
+ /etc/rc.d/sshd stop
+ stat_busy "Stopping Secure Shell Sessions"
+ for i in $(pgrep sshd); do
+ if readlink -q /proc/$i/exe | grep -q '^/usr/sbin/sshd'; then
+ kill $i
+ fi
+ done &>/dev/null
+ stat_done
+}
+
+add_hook shutdown_start sshd_close_sessions
diff --git a/src/openvpn/openvpn-tapdev.rc b/src/openvpn/openvpn-tapdev.rc
new file mode 100755
index 0000000..2c51f82
--- /dev/null
+++ b/src/openvpn/openvpn-tapdev.rc
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+. /etc/conf.d/openvpn-tapdev
+
+case "$1" in
+ start)
+ stat_busy "Creating tap devices for OpenVPN ... "
+ success=0
+ for tapdev in ${TAPDEVS}; do
+ stat_append "${tapdev} "
+ /usr/sbin/openvpn --mktun --dev-type tap --dev ${tapdev} >/dev/null 2>&1 || success=$?
+ done
+ if [ $success -eq 0 ]; then
+ add_daemon openvpn-tapdev
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Destroying tap devices for OpenVPN ..."
+ for tapdev in ${TAPDEVS}; do
+ stat_append "${tapdev} "
+ /usr/sbin/openvpn --rmtun --dev-type tap --dev ${tapdev} >/dev/null 2>&1 || success=$?
+ done
+ rm_daemon openvpn-tapdev
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/openvpn/openvpn.rc b/src/openvpn/openvpn.rc
new file mode 100755
index 0000000..96c28b6
--- /dev/null
+++ b/src/openvpn/openvpn.rc
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+CFGDIR="/etc/openvpn"
+STATEDIR="/var/run/openvpn"
+
+case "$1" in
+ start)
+ stat_busy "Starting OpenVPN ... "
+ success=0
+ mkdir -p "${STATEDIR}"
+ for cfg in "${CFGDIR}"/*.conf; do
+ stat_append "$(basename "${cfg}" .conf) "
+ /usr/sbin/openvpn --daemon --writepid "${STATEDIR}"/"$(basename "${cfg}" .conf)".pid --cd "${CFGDIR}" --config "${cfg}" || success=$?
+ done
+ if [ $success -eq 0 ]; then
+ add_daemon openvpn
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping OpenVPN ..."
+ for pidfile in "${STATEDIR}"/*.pid; do
+ stat_append "$(basename "${pidfile}" .pid) "
+ kill $(cat "${pidfile}" 2>/dev/null) 2>/dev/null
+ rm -f "${pidfile}"
+ done
+ rm_daemon openvpn
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/osiris/osirisd.init b/src/osiris/osirisd.init
new file mode 100755
index 0000000..8262d90
--- /dev/null
+++ b/src/osiris/osirisd.init
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+LOCKFILE=/var/run/osirisd.lock
+
+case "$1" in
+ start)
+ stat_busy "Starting Osiris Scanning Daemon"
+ [ ! -f $LOCKFILE ] && [ ! $UID = 0 ] && /usr/sbin/osirisd && touch $LOCKFILE
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Osiris Scanning Daemon"
+ [ -f $LOCKFILE ] && rm $LOCKFILE && killall osirisd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/osiris/osirismd.init b/src/osiris/osirismd.init
new file mode 100755
index 0000000..0bdae5e
--- /dev/null
+++ b/src/osiris/osirismd.init
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+LOCKFILE=/var/run/osirismd.lock
+
+case "$1" in
+ start)
+ stat_busy "Starting Osiris Management Daemon"
+ [ ! -f $LOCKFILE ] && [ ! $UID = 0 ] && touch $LOCKFILE && /usr/sbin/osirismd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Osiris Management Daemon"
+ [ -f $LOCKFILE ] && rm $LOCKFILE && killall osirismd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/oss/rc-script b/src/oss/rc-script
new file mode 100755
index 0000000..5c93010
--- /dev/null
+++ b/src/oss/rc-script
@@ -0,0 +1,30 @@
+#!/bin/bash
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy 'Starting Open Sound System'
+ if /usr/sbin/soundon; then
+ add_daemon oss
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy 'Stopping Open Sound System'
+ if /usr/sbin/soundoff; then
+ rm_daemon oss
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+esac
diff --git a/src/ossp/osspd.rc.d b/src/ossp/osspd.rc.d
new file mode 100755
index 0000000..edb7a1b
--- /dev/null
+++ b/src/ossp/osspd.rc.d
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/osspd
+
+
+if [[ -z "$DSP_SLAVE" ]]; then
+ # Autodetect
+ if [[ -x /usr/bin/pulseaudio ]]; then
+ DSP_SLAVE="/usr/sbin/ossp-padsp"
+ else
+ DSP_SLAVE="/usr/sbin/ossp-alsap"
+ fi
+fi
+
+PID=`pidof -o %PPID /usr/sbin/osspd`
+case "$1" in
+ start)
+ stat_busy "Starting OSS userspace bridge"
+ if [ -z "$PID" ]; then
+ modprobe -a cuse snd-seq-oss &>/dev/null
+ udevadm settle --quiet
+ /usr/sbin/osspd --dsp-slave="$DSP_SLAVE"
+ fi
+ if [ -n "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon osspd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping OSS userspace bridge"
+ [ -n "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon osspd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+
+# vim:set ft=sh:
diff --git a/src/p3scan/rc.p3scan b/src/p3scan/rc.p3scan
new file mode 100755
index 0000000..fc8b79b
--- /dev/null
+++ b/src/p3scan/rc.p3scan
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting p3scan"
+ [ -d /var/run/p3scan ] || mkdir -p /var/run/p3scan
+ if [ -a /var/run/p3scan/p3scan.pid ]; then stat_die; fi
+
+ # Start p3scan
+ /usr/sbin/p3scan
+ if ! [ -a /var/run/p3scan/p3scan.pid ]; then stat_die; fi
+ add_daemon p3scan
+ stat_done
+ ;;
+ stop)
+ stat_busy "Stopping p3scan"
+
+ # Stop p3scan
+ if [ -a /var/run/p3scan/p3scan.pid ]; then
+ kill `cat /var/run/p3scan/p3scan.pid` &>/dev/null || stat_die
+ rm -f /var/run/p3scan/p3scan.pid
+ rm_daemon p3scan
+ stat_done
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "Usage: $0 { start | stop | restart }"
+esac
+exit 0
diff --git a/src/partimage/partimaged b/src/partimage/partimaged
new file mode 100755
index 0000000..da810cb
--- /dev/null
+++ b/src/partimage/partimaged
@@ -0,0 +1,64 @@
+#!/bin/bash
+# This file belongs in /etc/rc.d
+#
+###############################################################################
+
+#inserting certain functions (like stat_busy)
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PARTIMAGE=/usr/sbin/
+
+# Check the file is there and is executable.
+[ -x $PARTIMAGE/partimaged ] || exit 0
+
+PID=`pidof -o %PPID /usr/sbin/partimaged`
+
+# See how we were called.
+case "$1" in
+ start)
+ stat_busy "Starting Partimage Daemon "
+ if [ -z "$PID" ]; then
+ /usr/sbin/partimaged -D &>/dev/null
+ RETVAL=$? #storing the status of the last command to RETVAL
+ if [ $? -gt 0 ]; then #if the status was other than 0, the command failed
+ stat_fail
+ exit 1
+ else
+ add_daemon partimaged
+ stat_done
+ fi
+ else
+ stat_fail
+ echo ":: Daemon already started as pid $PID"
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Partimage Daemon "
+ if [ "$PID" != "" ]; then #if PID exists
+ kill -KILL $PID &>/dev/null
+ stat_done
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ RETVAL=$?
+ rm_daemon partimaged
+ fi
+ else
+ stat_fail
+ echo ":: Daemon already stopped"
+ exit 1
+ fi
+ ;;
+ restart|reload)
+ $0 stop
+ $0 start
+ RETVAL=$?
+ ;;
+ *)
+ echo "Usage: partimaged {start|stop|restart|reload}"
+ exit 1
+esac
+exit $RETVAL
diff --git a/src/pcsclite/pcscd b/src/pcsclite/pcscd
new file mode 100755
index 0000000..1dc5e01
--- /dev/null
+++ b/src/pcsclite/pcscd
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DAEMON=/usr/sbin/pcscd
+NAME=pcscd
+DESC="PC/SC smart card daemon"
+PID_FILE=/run/pcscd/pcscd.pid
+PCSCD_OPTIONS=
+
+case "$1" in
+ start)
+ stat_busy "Starting $DESC"
+ $DAEMON $PCSCD_OPTIONS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon $NAME
+ stat_done
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $DESC"
+ [ -f $PID_FILE ] && kill `cat $PID_FILE` &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon $NAME
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $NAME status";
+ ck_status $NAME
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+ ;;
+
+esac
+
+exit 0
+
diff --git a/src/pdns-recursor/pdns-recursor.rc b/src/pdns-recursor/pdns-recursor.rc
new file mode 100755
index 0000000..992f0b0
--- /dev/null
+++ b/src/pdns-recursor/pdns-recursor.rc
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting PowerDNS recursor"
+ ! /usr/sbin/rec_control ping > /dev/null 2>&1 && /usr/sbin/pdns_recursor --daemon
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon pdns-recursor
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping PowerDNS recursor"
+ rec_control quit > /dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon pdns-recursor
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/pdns/pdns.rc b/src/pdns/pdns.rc
new file mode 100755
index 0000000..2f143dd
--- /dev/null
+++ b/src/pdns/pdns.rc
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting DNS"
+ ! /usr/sbin/pdns_control ping > /dev/null 2>&1 && /usr/sbin/pdns_server --daemon
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon pdns
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping DNS"
+ pdns_control quit > /dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon pdns
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/pdnsd/rc.d b/src/pdnsd/rc.d
new file mode 100755
index 0000000..34a541d
--- /dev/null
+++ b/src/pdnsd/rc.d
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/pdnsd`
+case "$1" in
+ start)
+ stat_busy "Starting pdnsd Daemon"
+ if [ -z "$PID" ]; then
+ /usr/sbin/pdnsd -d
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon pdnsd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping pdnsd Daemon"
+ [ ! -z "$PID" ] && kill -TERM $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon pdnsd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/percona-server/mysqld.rc b/src/percona-server/mysqld.rc
new file mode 100755
index 0000000..07f6b7e
--- /dev/null
+++ b/src/percona-server/mysqld.rc
@@ -0,0 +1,77 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+getPID() {
+ echo $(pgrep -u mysql mysqld 2>/dev/null);
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting Percona Server"
+ [ ! -d /var/run/mysqld ] && install -d -g mysql -o mysql /var/run/mysqld &>/dev/null
+ if [ -z "$(getPID)" ]; then
+ /usr/bin/mysqld_safe --user=mysql &>/dev/null &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ timeo=30
+ while [ $timeo -gt 0 ]; do
+ response=`/usr/bin/mysqladmin -uUNKNOWN_USER ping 2>&1` && break
+ echo "$response" | grep -q "mysqld is alive" && break
+ sleep 1
+ let timeo=${timeo}-1
+ done
+ if [ $timeo -eq 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo $(getPID) > /var/run/mysqld/mysqld.pid
+ add_daemon mysqld
+ stat_done
+ fi
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping Percona Server"
+ if [ ! -z "$(getPID)" ]; then
+ timeo=30
+ kill $(getPID) &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ fi
+ while [ ! -z "$(getPID)" -a $timeo -gt 0 ]; do
+ sleep 1
+ let timeo=${timeo}-1
+ done
+ if [ -z "$(getPID)" ]; then
+ rm -f /var/run/mysqld/mysqld.pid &>/dev/null
+ rm_daemon mysqld
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/php/rc.d.php-fpm b/src/php/rc.d.php-fpm
new file mode 100755
index 0000000..a8cb9ec
--- /dev/null
+++ b/src/php/rc.d.php-fpm
@@ -0,0 +1,144 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+
+wait_for_pid () {
+ try=0
+ while test $try -lt 35 ; do
+ case "$1" in
+ 'created')
+ if [ -f "$2" ] ; then
+ try=''
+ break
+ fi
+ ;;
+ 'removed')
+ if [ ! -f "$2" ] ; then
+ try=''
+ break
+ fi
+ ;;
+ esac
+
+ stat_append '.'
+ try=`expr $try + 1`
+ sleep 1
+ done
+}
+
+test_config() {
+ stat_busy 'Checking configuration'
+ if [ $(id -u) -ne 0 ]; then
+ stat_append '(This script must be run as root)'
+ stat_die
+ fi
+
+ if [ ! -r /etc/php/php-fpm.conf ]; then
+ stat_append '(/etc/php/php-fpm.conf not found)'
+ stat_die
+ fi
+
+ local test=$(/usr/sbin/php-fpm -t 2>&1)
+ if [ $? -gt 0 ]; then
+ stat_append '(error in /etc/php/php-fpm.conf)'
+ stat_die
+ elif echo $test | grep -qi 'error'; then
+ stat_append '(error in /etc/php/php.ini)'
+ stat_die
+ fi
+
+ stat_done
+}
+
+case "$1" in
+ start)
+ test_config
+ stat_busy 'Starting php-fpm'
+
+ /usr/sbin/php-fpm --daemonize --pid /run/php-fpm/php-fpm.pid
+
+ if [ "$?" != 0 ] ; then
+ stat_fail
+ exit 1
+ fi
+
+ wait_for_pid created /run/php-fpm/php-fpm.pid
+
+ if [ -n "$try" ] ; then
+ stat_fail
+ exit 1
+ else
+ add_daemon php-fpm
+ stat_done
+ fi
+ ;;
+
+ stop)
+ test_config
+ stat_busy 'Gracefully shutting down php-fpm'
+
+ if [ ! -r /run/php-fpm/php-fpm.pid ] ; then
+ stat_fail
+ exit 1
+ fi
+
+ kill -QUIT `cat /run/php-fpm/php-fpm.pid`
+
+ wait_for_pid removed /run/php-fpm/php-fpm.pid
+
+ if [ -n "$try" ] ; then
+ stat_fail
+ exit 1
+ else
+ rm_daemon php-fpm
+ stat_done
+ fi
+ ;;
+
+ force-quit)
+ stat_busy 'Terminating php-fpm'
+
+ if [ ! -r /run/php-fpm/php-fpm.pid ] ; then
+ stat_fail
+ exit 1
+ fi
+
+ kill -TERM `cat /run/php-fpm/php-fpm.pid`
+
+ wait_for_pid removed /run/php-fpm/php-fpm.pid
+
+ if [ -n "$try" ] ; then
+ stat_fail
+ exit 1
+ else
+ rm_daemon php-fpm
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ $0 start
+ ;;
+
+ reload)
+ test_config
+ stat_busy 'Reload service php-fpm'
+
+ if [ ! -r /run/php-fpm/php-fpm.pid ] ; then
+ stat_fail
+ exit 1
+ fi
+
+ kill -USR2 `cat /run/php-fpm/php-fpm.pid`
+ stat_done
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|force-quit|restart|reload|logrotate}"
+ exit 1
+ ;;
+
+esac
diff --git a/src/postfix/rc.d b/src/postfix/rc.d
new file mode 100755
index 0000000..fa314bb
--- /dev/null
+++ b/src/postfix/rc.d
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+name=postfix
+
+case "$1" in
+start)
+ stat_busy "Starting $name daemon"
+ /usr/sbin/postfix start &>/dev/null \
+ && { add_daemon $name; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+stop)
+ stat_busy "Stopping $name daemon"
+ /usr/sbin/postfix stop &>/dev/null \
+ && { rm_daemon $name; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+reload)
+ stat_busy "Reloading $name daemon"
+ /usr/sbin/postfix reload &>/dev/null \
+ && { stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+*)
+ echo "usage: $0 {start|stop|restart|reload}"
+ ;;
+esac
+exit 0
diff --git a/src/postgresql/postgresql.rcd b/src/postgresql/postgresql.rcd
new file mode 100755
index 0000000..f3600b3
--- /dev/null
+++ b/src/postgresql/postgresql.rcd
@@ -0,0 +1,79 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/postgresql
+
+# Default PGROOT if it wasn't defined in the conf.d file
+PGROOT=${PGROOT:-/var/lib/postgres}
+PGLOG=${PGLOG:-/var/log/postgresql.log}
+PGCTL_BIN=/usr/bin/pg_ctl
+PGCTL_ARGS=(-D "$PGROOT/data" -l "$PGLOG" -s -w)
+[[ $PGOPTS ]] && PGCTL_ARGS+=(-o "$PGOPTS")
+
+postgres_init() {
+ # initialization
+ if [[ ! -d "$PGROOT/data" ]]; then
+ mkdir -p "$PGROOT/data" && chown -R postgres:postgres "$PGROOT"
+ su - postgres -c "/usr/bin/initdb $INITOPTS -D '$PGROOT/data'"
+ fi
+ if [[ ! -e "$PGLOG" ]]; then
+ touch "$PGLOG"
+ chown postgres "$PGLOG"
+ fi
+}
+
+do_postgres() {
+ su - postgres -c "'$PGCTL_BIN' $(printf '%q ' "${PGCTL_ARGS[@]}" "$@")"
+}
+
+case $1 in
+ start)
+ postgres_init
+ stat_busy "Starting PostgreSQL"
+ if do_postgres start; then
+ add_daemon postgresql
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping PostgreSQL"
+ if do_postgres stop -m fast; then
+ rm_daemon postgresql
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ reload)
+ stat_busy "Reloading PostgreSQL"
+ if do_postgres reload; then
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ restart)
+ postgres_init
+ stat_busy "Restarting PostgreSQL"
+ if do_postgres restart -m fast; then
+ add_daemon postgresql
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ status)
+ stat_busy "Checking PostgreSQL status";
+ ck_status postgresql
+ ;;
+ *)
+ echo "usage: $0 {start|stop|reload|restart|status}"
+ exit 1
+esac
diff --git a/src/postgrey/postgrey.rc b/src/postgrey/postgrey.rc
new file mode 100755
index 0000000..dc25887
--- /dev/null
+++ b/src/postgrey/postgrey.rc
@@ -0,0 +1,74 @@
+#!/bin/bash
+
+# source application-specific settings
+POSTGREY_CONF=/etc/conf.d/postgrey
+[ -f $POSTGREY_CONF ] && . $POSTGREY_CONF
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+GROUP="postgrey"
+USER="postgrey"
+DAEMON_NAME="postgrey"
+POSTGREY_BIN="/usr/sbin/postgrey"
+PIDFILE=/var/run/postgrey/postgrey.pid
+
+mkdir -p /var/run/postgrey
+chown $USER:$GROUP /var/run/postgrey
+
+PID=`cat $PIDFILE 2>/dev/null`
+[ -d /proc/$PID ] || PID=""
+
+checkconfig() {
+ if [ -z $POSTGREY_ADDR ]; then
+ echo "You need to set POSTGREY_ADDR instead of POSTGREY_TYPE parameter bundle"
+ return 1
+ fi
+}
+
+start() {
+ stat_busy "Starting Postgrey"
+ checkconfig || { stat_fail; return 1; }
+
+ [ -z "$PID" ] && $POSTGREY_BIN --daemonize $POSTGREY_ADDR \
+ --group=$GROUP --user=$USER $POSTGREY_OPTS --pidfile=$PIDFILE \
+ --greylist-text="$POSTGREY_TEXT" > /dev/null
+
+ if [ $? -gt 0 ]
+ then
+ stat_fail
+ else
+ add_daemon postgrey
+ stat_done
+ fi
+}
+
+stop() {
+ stat_busy "Stopping Postgrey"
+ [ ! -z "$PID" ] && kill -9 $PID &> /dev/null
+ if [ $? -gt 0 ]
+ then
+ stat_fail
+ else
+ rm_daemon postgrey
+ rm -f $PIDFILE
+ stat_done
+ fi
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ # calling 'stop' and 'start' without the $0 fails...
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ esac
+exit 0
diff --git a/src/pound/pound.init b/src/pound/pound.init
new file mode 100755
index 0000000..b8187c8
--- /dev/null
+++ b/src/pound/pound.init
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting Pound"
+ /usr/sbin/pound -f /etc/pound/pound.cfg -p /var/run/pound.pid &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon pound
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Pound"
+ [ -f /var/run/pound.pid ] && kill `cat /var/run/pound.pid`
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /var/run/pound.pid
+ rm_daemon pound
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/src/pound/pound.runit b/src/pound/pound.runit
new file mode 100755
index 0000000..ed59ea0
--- /dev/null
+++ b/src/pound/pound.runit
@@ -0,0 +1,23 @@
+#!/bin/sh
+exec 2>&1
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+BIN=/usr/sbin/pound
+OPTS="-f /etc/pound/pound.cfg -p /var/run/pound.pid"
+SVC=pound
+
+PID=`pidof $BIN`
+if [ -z "$PID" ]
+then
+ if [ -f /var/run/$SVC.pid ]
+ then
+ rm /var/run/$SVC.pid
+ rm_daemon $SVC
+ fi
+ echo "Starting $SVC daemon"
+ $BIN $OPTS
+else
+ [ -z $PID ] || exec watchpid $PID
+fi
diff --git a/src/ppp/ppp b/src/ppp/ppp
new file mode 100755
index 0000000..16e01ba
--- /dev/null
+++ b/src/ppp/ppp
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/pppd`
+case "$1" in
+ start)
+ stat_busy "Starting PPP daemon"
+ [ -z "$PID" ] && /usr/bin/pon
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ppp
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping PPP daemon"
+ [ ! -z "$PID" ] && poff -a &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ppp
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/pptpd/pptpd b/src/pptpd/pptpd
new file mode 100755
index 0000000..08c4de4
--- /dev/null
+++ b/src/pptpd/pptpd
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting PPTP Daemon"
+ pptpd -c /etc/pptpd.conf -p /var/run/pptpd.pid
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon pptpd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping PPTP Daemon"
+ kill `cat /var/run/pptpd.pid`
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon pptpd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/preload/rc.d b/src/preload/rc.d
new file mode 100755
index 0000000..a3cb01b
--- /dev/null
+++ b/src/preload/rc.d
@@ -0,0 +1,97 @@
+#!/bin/bash
+#
+# /etc/rc.d/init.d/preload
+#
+# Starts the preload daemon
+#
+# Heavily modified for Arch Linux by Leslie P. Polzer <polzer@gnu.org>.
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/preload`
+
+if [ -f /etc/conf.d/preload ]; then
+ . /etc/conf.d/preload
+fi
+
+MIN_MEMORY=${MIN_MEMORY:-256}
+# Check for > MIN_MEMORY MB
+free -m | awk '/Mem:/ {exit ($2 >= ('"$MIN_MEMORY"'))?0:1}' || exit 0
+
+RETVAL=0
+
+#
+# See how we were called.
+#
+
+start() {
+ if [ -z "$PID" ]; then
+ stat_busy "Starting preload daemon: "
+ /usr/sbin/preload $PRELOAD_OPTS
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ if [ -n $IONICE_OPTS ]; then
+ /usr/bin/ionice $IONICE_OPTS -p "`pidof -o %PPID /usr/sbin/preload`"
+ fi
+ add_daemon preload
+ stat_done
+ else
+ stat_fail
+ fi
+ fi
+ return $RETVAL
+}
+
+stop() {
+ stat_busy "Stopping preload daemon: "
+ kill $PID &>/dev/null
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ]; then
+ rm_daemon preload
+ stat_done
+ PID=""
+ else
+ stat_fail
+ fi
+ return $RETVAL
+}
+
+
+restart() {
+ $0 stop
+ sleep 1
+ $0 start
+}
+
+reload() {
+ trap "" SIGHUP
+ kill -HUP $PID
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ reload)
+ reload
+ ;;
+ restart)
+ restart
+ ;;
+ condrestart)
+ if [ ! -z $PID ]; then
+ restart
+ else
+ stat_fail
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|condrestart|reload}"
+ exit 1
+esac
+
+exit $RETVAL
diff --git a/src/privoxy/privoxy b/src/privoxy/privoxy
new file mode 100755
index 0000000..754453d
--- /dev/null
+++ b/src/privoxy/privoxy
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+# source application-specific settings
+[ -f /etc/conf.d/privoxy ] && . /etc/conf.d/privoxy
+
+# read logdir and logfile from privoxy config
+prld=`grep ^logdir "$PRIVOXY_CONF" 2>/dev/null | cut -d' ' -f2`
+[ -n "$prld" ] || prld=/var/log/privoxy
+prlf=`grep ^logfile "$PRIVOXY_CONF" 2>/dev/null | cut -d' ' -f2`
+[ -n "$prlf" ] || prlf=logfile
+
+PID=`pidof -o %PPID /usr/sbin/privoxy`
+
+case "$1" in
+ start)
+ stat_busy "Starting Privoxy"
+ # create missing logdir and logfile
+ [ -d "$prld" ] || mkdir -p "$prld"
+ if [ ! -f "$prlf" ]; then
+ touch "$prld/$prlf" && chgrp "${PRIVOXY_GROUP}" "$prld/$prlf" && \
+ chmod 0660 "$prld/$prlf"
+ fi
+ [ -z "$PID" ] && /usr/sbin/privoxy --user ${PRIVOXY_USER}.${PRIVOXY_GROUP} \
+ ${PRIVOXY_ARGS} ${PRIVOXY_CONF}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon privoxy
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Privoxy"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon privoxy
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/proftpd/proftpd b/src/proftpd/proftpd
new file mode 100755
index 0000000..9ea1d47
--- /dev/null
+++ b/src/proftpd/proftpd
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# source application-specific settings
+PROFTPD_ARGS=
+[ -f /etc/conf.d/proftpd ] && . /etc/conf.d/proftpd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting ProFTPd Server"
+ /usr/sbin/proftpd ${PROFTPD_ARGS}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon proftpd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ProFTPd Server"
+ [ -f /run/proftpd/proftpd.pid ] && kill $(cat /run/proftpd/proftpd.pid) &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /run/proftpd/proftpd.pid
+ rm_daemon proftpd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
+
diff --git a/src/prosody/prosody.rcd b/src/prosody/prosody.rcd
new file mode 100755
index 0000000..afaf779
--- /dev/null
+++ b/src/prosody/prosody.rcd
@@ -0,0 +1,93 @@
+#!/bin/bash
+
+daemon_name=prosody
+pid_file=/var/run/$daemon_name/$daemon_name.pid
+
+source /etc/rc.conf
+source /etc/rc.d/functions
+
+get_pid() {
+ if [ -f $pid_file ]; then
+ /bin/kill -0 $(cat $pid_file)
+ if [ $? == 0 ]; then
+ cat $pid_file
+ fi
+ fi
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name daemon"
+
+ [ -d /var/run/$daemon_name ] || { mkdir -p /var/run/$daemon_name ; chown prosody:prosody /var/run/prosody; }
+ PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ [ -f $pid_file ] && rm -f $pid_file
+ mkdir -p `dirname $pid_file`
+ prosodyctl start 1>/dev/null 2>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ printhl "$daemon_name is already running"
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ PID=$(get_pid)
+ if [ ! -z "$PID" ]; then
+ prosodyctl stop 1>/dev/null 2>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f $pid_file &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ printhl "$daemon_name is not running"
+ exit 1
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ $0 start
+ ;;
+
+ reload)
+ stat_busy "Reloading $daemon_name"
+ PID=$(get_pid)
+ if [ ! -z "$PID" ]; then
+ /bin/kill -HUP $PID 2> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ stat_done
+ fi
+ else
+ stat_fail
+ printhl "$daemon_name is not running"
+ fi
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|reload|status}"
+ esac
+
+exit 0
diff --git a/src/pyaimt/pyaim.rc b/src/pyaimt/pyaim.rc
new file mode 100755
index 0000000..486098e
--- /dev/null
+++ b/src/pyaimt/pyaim.rc
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ [ -f /var/run/pyaimt.pid ] && echo `cat /var/run/pyaimt.pid`
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting jabber AIM transport daemon"
+
+ [ -f /var/run/pyaimt.pid ] && rm -f /var/run/pyaimt.pid
+ PID=`get_pid`
+ if [ -z "$PID" ]; then
+ cd /usr/lib/pyaimt && exec python2 ./PyAIMt.py 1>/dev/null 2>/dev/null &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon pyaimt
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping jabber AIM transport daemon"
+ PID=`get_pid`
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/pyaimt.pid &> /dev/null
+ rm_daemon pyaimt
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/pyicqt/pyicq.rc b/src/pyicqt/pyicq.rc
new file mode 100755
index 0000000..5296160
--- /dev/null
+++ b/src/pyicqt/pyicq.rc
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ [ -f /var/run/pyicqt.pid ] && echo `cat /var/run/pyicqt.pid`
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting jabber ICQ transport daemon"
+
+ [ -f /var/run/pyicqt.pid ] && rm -f /var/run/pyicqt.pid
+ PID=`get_pid`
+ if [ -z "$PID" ]; then
+ cd /usr/lib/pyicqt && exec python2 ./PyICQt.py 1>/dev/null 2>/dev/null &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon pyicqt
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping jabber ICQ transport daemon"
+ PID=`get_pid`
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/pyicqt.pid &> /dev/null
+ rm_daemon pyicqt
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/pymsnt/pymsn.rc b/src/pymsnt/pymsn.rc
new file mode 100755
index 0000000..a3aec15
--- /dev/null
+++ b/src/pymsnt/pymsn.rc
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ [ -f /var/run/pymsnt.pid ] && echo `cat /var/run/pymsnt.pid`
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting jabber MSN transport daemon"
+
+ [ -f /var/run/pymsnt.pid ] && rm -f /var/run/pymsnt.pid
+ PID=`get_pid`
+ if [ -z "$PID" ]; then
+ cd /usr/lib/pymsnt && exec python2 ./PyMSNt.py 1>/dev/null 2>/dev/null &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon pymsnt
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping jabber MSN transport daemon"
+ PID=`get_pid`
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/pymsnt.pid &> /dev/null
+ rm_daemon pymsnt
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/pyrss/pyrss.rc b/src/pyrss/pyrss.rc
new file mode 100755
index 0000000..168d95a
--- /dev/null
+++ b/src/pyrss/pyrss.rc
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ ps fax|grep -E 'python2 pyrss|python2 ./start' | grep -v grep | cut -f1 -d' '
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting jabber RSS transport daemon"
+
+ [ -f /var/run/pyrss.pid ] && rm -f /var/run/pyrss.pid
+ PID=`get_pid`
+ if [ -z "$PID" ]; then
+ cd /usr/lib/pyrss && exec python2 ./start.py 1>/dev/null 2>/dev/null &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon pyrss
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping jabber RSS transport daemon"
+ PID=`get_pid`
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/pyrss.pid &> /dev/null
+ rm_daemon pyrss
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/quagga/quagga.rc b/src/quagga/quagga.rc
new file mode 100755
index 0000000..ad6614b
--- /dev/null
+++ b/src/quagga/quagga.rc
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+DAEMON=/usr/sbin/${0##*/}
+PID=$(pidof -o %PPID $DAEMON)
+
+case "$1" in
+ start)
+ stat_busy "Starting ${0##*/} daemon"
+ [[ ! $PID ]] && $DAEMON $DAEMON_OPTS && add_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ stop)
+ stat_busy "Stopping ${0##*/} daemon"
+ [[ $PID ]] && kill $PID &> /dev/null && rm_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit 0
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ ;;
+esac
+
+exit 1
+
+# vim:set ts=2 sw=2 ft=sh noet:
diff --git a/src/quassel/rc.quassel b/src/quassel/rc.quassel
new file mode 100755
index 0000000..99b82ee
--- /dev/null
+++ b/src/quassel/rc.quassel
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/quassel
+
+PIDFILE=/var/run/quassel.pid
+PID=`pidof -o %PPID /usr/bin/quasselcore`
+
+case "$1" in
+ start)
+ stat_busy "Starting Quassel Core"
+ [ -z "$PID" ] && su -l -c "/usr/bin/quasselcore --configdir=/var/lib/quassel --listen=$LISTEN &" $QUASSEL_USER &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo $PID > $PIDFILE
+ add_daemon quassel
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Quassel Core"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f $PIDFILE
+ rm_daemon quassel
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/radvd/radvd.rc b/src/radvd/radvd.rc
new file mode 100755
index 0000000..3cac104
--- /dev/null
+++ b/src/radvd/radvd.rc
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+DAEMON=/usr/sbin/radvd
+PIDFILE=${PIDFILE:-/run/${0##*/}.pid}
+DAEMON_OPTS+=("--pidfile=$PIDFILE")
+
+# check pid file
+[[ -r "$PIDFILE" ]] &&
+ read PID < "$PIDFILE" && [[ -n $PID ]] && kill -0 $PID || unset PID
+
+case "$1" in
+ start)
+ stat_busy "Starting ${0##*/} daemon"
+ [[ ! $PID ]] && $DAEMON "${DAEMON_OPTS[@]}" &&
+ add_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ stop)
+ stat_busy "Stopping ${0##*/} daemon"
+ [[ $PID ]] && kill $PID &> /dev/null && rm_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit 0
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ ;;
+esac
+
+exit 1
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/redis/redis.d b/src/redis/redis.d
new file mode 100755
index 0000000..e1c79dd
--- /dev/null
+++ b/src/redis/redis.d
@@ -0,0 +1,78 @@
+#!/bin/bash
+
+daemon_name=redis
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+REDISPORT=6379
+EXEC=/usr/bin/redis-server
+CLIEXEC=/usr/bin/redis-cli
+PIDFILE=/var/run/redis.pid
+WORKDIR=/var/lib/redis
+CONF="/etc/redis.conf"
+
+# Check if process exists
+PID=$(cat $PIDFILE 2>/dev/null)
+[ -d /proc/${PID} ] || rm -f $PIDFILE
+
+# Grab the server password, if exists
+REDISPASS=`egrep -o '^requirepass ([^#]+)' $CONF | cut -d\ -f 2`
+[ -n "$REDISPASS" ] && CLIEXEC="$CLIEXEC -a $REDISPASS"
+
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name"
+ [ -d $WORKDIR ] || mkdir $WORKDIR
+
+ if [ -f $PIDFILE ]; then
+ stat_fail
+ exit 1
+ else
+ $EXEC $CONF >/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon $daemon_name
+ stat_done
+ fi
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name"
+
+ if [ ! -f $PIDFILE ]; then
+ stat_fail
+ exit 1
+ else
+ PID=$(cat $PIDFILE)
+
+ # And grab the server address
+ REDISADDR=`egrep -o '^bind ([^#]+)' $CONF | cut -d' ' -f2`
+ [ -n "$REDISADDR" ] && CLIEXEC="$CLIEXEC -h $REDISADDR"
+
+ $CLIEXEC -p $REDISPORT shutdown
+ [ -d /proc/${PID} ] && sleep 1
+ [ -d /proc/${PID} ] && sleep 5
+ [ -d /proc/${PID} ] && kill -9 $PID
+ [ -d /proc/${PID} ] && stat_fail || { stat_done; rm_daemon $daemon_name; }
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+exit 0
diff --git a/src/rfkill/rc.d b/src/rfkill/rc.d
new file mode 100755
index 0000000..ce90ee1
--- /dev/null
+++ b/src/rfkill/rc.d
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/rfkill
+
+case "$1" in
+ start)
+ for device in ${RFKILL_BLOCK}; do
+ stat_busy "Blocking rfkill device: ${device}"
+ /usr/sbin/rfkill block ${device}
+ if [ $? -eq 0 ]; then
+ stat_done
+ else
+ stat_fail
+ fi
+ done
+ for device in ${RFKILL_UNBLOCK}; do
+ stat_busy "Unblocking rfkill device: ${device}"
+ /usr/sbin/rfkill unblock ${device}
+ if [ $? -eq 0 ]; then
+ stat_done
+ else
+ stat_fail
+ fi
+ done
+ ;;
+ stop)
+ ;;
+ restart)
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start}"
+ exit 1
+ ;;
+esac
+exit 0
diff --git a/src/rng-tools/rngd b/src/rng-tools/rngd
new file mode 100755
index 0000000..bd6b8d6
--- /dev/null
+++ b/src/rng-tools/rngd
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+rnd_device=/dev/random
+rng_device=/dev/hw_random
+timeout=0
+
+[ -f /etc/conf.d/rngd ] && . /etc/conf.d/rngd
+PID=$(pidof -o %PPID /usr/sbin/rngd)
+case "$1" in
+ start)
+ stat_busy "Starting RNG"
+ [ -z "$PID" ] && /usr/sbin/rngd $RNGD_OPTS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon rngd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping RNG"
+ [ ! -z "$PID" ] && kill -s SIGALRM $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon rngd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/rp-pppoe/adsl b/src/rp-pppoe/adsl
new file mode 100755
index 0000000..33bd918
--- /dev/null
+++ b/src/rp-pppoe/adsl
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting ADSL Connection"
+ /usr/sbin/pppoe-start &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon adsl
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping ADSL Connection"
+ /usr/sbin/pppoe-stop &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon adsl
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/rpcbind/rpcbind b/src/rpcbind/rpcbind
new file mode 100755
index 0000000..87c5b50
--- /dev/null
+++ b/src/rpcbind/rpcbind
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID="$(pidof -o %PPID /usr/bin/rpcbind)"
+case "$1" in
+ start)
+ stat_busy "Starting rpcbind"
+ [ -z "$PID" ] && /usr/bin/rpcbind &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ PID=$(pidof -o %PPID /usr/bin/rpcbind)
+ echo $PID > /var/run/rpcbind.pid
+ add_daemon rpcbind
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping rpcbind"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm /var/run/rpcbind.pid
+ rm_daemon rpcbind
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/rsync/rsyncd b/src/rsync/rsyncd
new file mode 100755
index 0000000..27836d5
--- /dev/null
+++ b/src/rsync/rsyncd
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+[ -f /etc/conf.d/rsyncd ] && . /etc/conf.d/rsyncd
+
+case "$1" in
+ start)
+ stat_busy "Starting rsyncd"
+ [ ! -f /run/daemons/rsyncd ] && /usr/bin/rsync --daemon $RSYNCD_ARGS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon rsyncd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping rsyncd"
+ [ -f /run/rsyncd.pid ] && kill `cat /run/rsyncd.pid`
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon rsyncd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/rsyslog/rsyslog b/src/rsyslog/rsyslog
new file mode 100755
index 0000000..ee01454
--- /dev/null
+++ b/src/rsyslog/rsyslog
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/rsyslog
+
+PID=`pidof -o %PPID /usr/sbin/rsyslogd`
+case "$1" in
+ start)
+ stat_busy "Starting RSyslogd"
+ [ -z "$PID" ] && /usr/sbin/rsyslogd $RSYSLOGD_ARGS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon rsyslogd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping RSyslogd"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /var/run/rsyslogd.pid
+ rm -f /var/rsyslogd.persist
+ rm_daemon rsyslogd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/samba/samba b/src/samba/samba
new file mode 100755
index 0000000..6098ee0
--- /dev/null
+++ b/src/samba/samba
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+[ -f /etc/conf.d/samba ] && . /etc/conf.d/samba
+
+[ -z "$SAMBA_DAEMONS" ] && SAMBA_DAEMONS=(smbd nmbd)
+
+case "$1" in
+ start)
+ rc=0
+ stat_busy "Starting Samba Server"
+ if [ ! -x /var/log/samba ] ; then
+ install -m755 -d /var/log/samba
+ fi
+ for d in ${SAMBA_DAEMONS[@]}; do
+ PID=`pidof -o %PPID /usr/sbin/$d`
+ [ -z "$PID" ] && /usr/sbin/$d -D
+ rc=$(($rc+$?))
+ done
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon samba
+ stat_done
+ fi
+ ;;
+ stop)
+ rc=0
+ stat_busy "Stopping Samba Server"
+ for d in ${SAMBA_DAEMONS[@]}; do
+ PID=`pidof -o %PPID /usr/sbin/$d`
+ [ -z "$PID" ] || kill $PID &> /dev/null
+ rc=$(($rc+$?))
+ done
+ if [ $rc -gt 0 ]; then
+ stat_fail
+ else
+ rm /run/samba/smbd.pid &>/dev/null
+ rm /run/samba/nmbd.pid &>/dev/null
+ rm /run/samba/winbindd.pid &>/dev/null
+ rm_daemon samba
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/sauerbraten/sauerbraten.rcd b/src/sauerbraten/sauerbraten.rcd
new file mode 100755
index 0000000..fb95aae
--- /dev/null
+++ b/src/sauerbraten/sauerbraten.rcd
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting sauerbraten-server"
+ [ ! -f /var/run/daemons/sauerbraten ] && /usr/sbin/sauerbraten-server
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ pgrep -of "/opt/sauerbraten/bin/linux_server" > /var/run/sauerbraten.pid
+ add_daemon sauerbraten
+ stat_done
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping sauerbraten-server"
+ [ -f /var/run/sauerbraten.pid ] && kill `cat /var/run/sauerbraten.pid`
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon sauerbraten
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/ser2net/ser2net.init b/src/ser2net/ser2net.init
new file mode 100755
index 0000000..f359846
--- /dev/null
+++ b/src/ser2net/ser2net.init
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ pidof ser2net
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting ser2net daemon"
+
+ PID=`get_pid`
+ if [ -z "$PID" ]; then
+ [ -f /var/run/ser2net.pid ] && rm -f /var/run/ser2net.pid
+ ser2net
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo `get_pid` > /var/run/ser2net.pid
+ add_daemon ser2net
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping ser2net daemon"
+ PID=`get_pid`
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/ser2net.pid &> /dev/null
+ rm_daemon ser2net
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/slim/rc.d b/src/slim/rc.d
new file mode 100755
index 0000000..b0be7ff
--- /dev/null
+++ b/src/slim/rc.d
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/slim`
+case "$1" in
+ start)
+ stat_busy "Starting Simple Login Manager"
+ [ -z "$PID" ] && /usr/bin/slim -d &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon slim
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Simple Login Manager"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon slim
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/slmodem-utils/slmodem-alsa.rc.d b/src/slmodem-utils/slmodem-alsa.rc.d
new file mode 100755
index 0000000..1cff203
--- /dev/null
+++ b/src/slmodem-utils/slmodem-alsa.rc.d
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# source application-specific settings
+SLMODEM_ARGS=
+[ -f /etc/conf.d/slmodem-alsa ] && . /etc/conf.d/slmodem-alsa
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting SL-Modem Drivers"
+ slmodemd ${SLMODEM_ARGS} > /dev/null 2>&1 &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon slmodem
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping SL-Modem Drivers"
+ killall -9 slmodemd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon slmodem
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "Usage $0 {start|stop|restart}"
+ ;;
+esac
diff --git a/src/slmodem-utils/slmodem.rc.d b/src/slmodem-utils/slmodem.rc.d
new file mode 100755
index 0000000..ec325cc
--- /dev/null
+++ b/src/slmodem-utils/slmodem.rc.d
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+# source application-specific settings
+SLMODEM_ARGS=
+[ -f /etc/conf.d/slmodem ] && . /etc/conf.d/slmodem
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting SL-Modem Drivers"
+ if ! [ -e /dev/slamr0 ]; then
+ mknod /dev/slamr0 c 242 0
+ fi
+ slmodemd ${SLMODEM_ARGS} > /dev/null 2>&1 &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon slmodem
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping SL-Modem Drivers"
+ killall -9 slmodemd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon slmodem
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "Usage $0 {start|stop|restart}"
+ ;;
+esac
diff --git a/src/smartmontools/smartd.rc b/src/smartmontools/smartd.rc
new file mode 100755
index 0000000..16920db
--- /dev/null
+++ b/src/smartmontools/smartd.rc
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# source application-specific settings
+SMARTD_ARGS=
+[ -f /etc/conf.d/smartd ] && . /etc/conf.d/smartd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+
+ start)
+ stat_busy "Starting smartd"
+ /usr/sbin/smartd ${SMARTD_ARGS} &>/dev/null
+ if [ $? -ne 0 ]; then
+ stat_fail
+ else
+ add_daemon smartd
+ stat_done
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping smartd"
+ kill -9 `pidof /usr/sbin/smartd` &>/dev/null
+ rm_daemon smartd
+ stat_done
+ ;;
+
+ restart)
+ stat_busy "Restarting smartd ..."
+ $0 stop
+ $0 start
+ stat_done
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/smbnetfs/rc-smbnetfs b/src/smbnetfs/rc-smbnetfs
new file mode 100755
index 0000000..69c00d1
--- /dev/null
+++ b/src/smbnetfs/rc-smbnetfs
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+. /etc/conf.d/smbnetfs
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ echo `pidof smbnetfs`
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting smbnetfs"
+
+ [ -f /var/run/smbnetfs.pid ] && rm -f /var/run/smbnetfs.pid
+ PID=`get_pid`
+ if [ -z "$PID" ]; then
+ cd /tmp && \
+ [ -d $SMBNETFS_MOUNT_POINT ] && \
+ su - nobody -s /bin/bash -c "HOME=/etc/smbnetfs exec smbnetfs -o allow_other $SMBNETFS_MOUNT_POINT" &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo `get_pid` > /var/run/smbnetfs.pid
+ add_daemon smbnetfs
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping smbnetfs"
+
+ fusermount -u $SMBNETFS_MOUNT_POINT &> /dev/null
+ rm -f /var/run/smbnetfs.pid &> /dev/null
+ rm_daemon smbnetfs
+ stat_done
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/spamassassin/spamd b/src/spamassassin/spamd
new file mode 100755
index 0000000..3fb9756
--- /dev/null
+++ b/src/spamassassin/spamd
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+# source application-specific settings
+[ -f /etc/conf.d/spamd ] && . /etc/conf.d/spamd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PIDFILE=/var/run/spamd.pid
+if [ -f $PIDFILE ]; then
+ PID=$(cat $PIDFILE)
+else
+ PID=$(pidof -o %PPID /usr/bin/vendor_perl/spamd) #backward compat
+fi
+
+case "$1" in
+ start)
+ stat_busy "Starting spamd"
+ [ -z "$PID" ] && /usr/bin/vendor_perl/spamd -d -r "$PIDFILE" ${SPAMD_OPTS}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon spamd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping spamd"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ # Some users report that a second attempt at stopping the process
+ # works. So, take a little nap and give it another whirl...
+ sleep 2
+ kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon spamd
+ stat_done
+ fi
+ else
+ rm_daemon spamd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
+# vim: ts=2 sw=2 et ft=sh
diff --git a/src/speech-dispatcher/speechd.sh b/src/speech-dispatcher/speechd.sh
new file mode 100755
index 0000000..eb44198
--- /dev/null
+++ b/src/speech-dispatcher/speechd.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=$(pidof -o %PPID /usr/bin/speech-dispatcher)
+case "$1" in
+ start)
+ stat_busy "Starting speech dispatcher Daemon"
+ [ -z "$PID" ] && /usr/bin/speech-dispatcher -d &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon speechd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping speech dispatcher Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon speechd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+
+exit 0
diff --git a/src/squid/squid b/src/squid/squid
new file mode 100755
index 0000000..da55344
--- /dev/null
+++ b/src/squid/squid
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# source application-specific settings
+[[ -f /etc/conf.d/squid ]] && . /etc/conf.d/squid
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+pidfile=/run/squid.pid
+{ read -r PID </run/squid.pid; } 2>/dev/null
+if [[ $pid && ! /proc/$pid/exe -ef /usr/sbin/squid ]]; then
+ rm /run/squid.pid
+fi
+
+case $1 in
+ start)
+ stat_busy "Starting squid"
+ if [[ $PID ]] || ! squid $SQUID_ARGS; then
+ stat_fail
+ else
+ add_daemon squid
+ stat_done
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping squid"
+ if [[ -z $PID ]] || ! squid -k shutdown &>/dev/null; then
+ stat_fail
+ else
+ # squid takes forever to shutdown all its listening FDs
+ while [[ /proc/$PID/exe -ef /usr/sbin/squid ]]; do
+ stat_append "."
+ sleep 3
+ done
+ rm_daemon squid
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/sshguard/sshguard.rc b/src/sshguard/sshguard.rc
new file mode 100755
index 0000000..dbd95c9
--- /dev/null
+++ b/src/sshguard/sshguard.rc
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+[ -f /etc/conf.d/sshguard ] && . /etc/conf.d/sshguard
+
+case "$1" in
+ start)
+ stat_busy "Starting SSHGuard"
+ /usr/sbin/sshguard -l /var/log/auth.log -b /var/db/sshguard/blacklist.db ${SSHGUARD_ARGS} &> /dev/null &
+ add_daemon sshguard
+ stat_done
+ ;;
+ stop)
+ stat_busy "Stopping SSHGuard"
+ kill `pidof sshguard` &> /dev/null
+ rm_daemon sshguard
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+*)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/sslh/sslh.rc b/src/sslh/sslh.rc
new file mode 100755
index 0000000..456e122
--- /dev/null
+++ b/src/sslh/sslh.rc
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+DAEMON=/usr/bin/sslh
+PID=$(pidof -o %PPID $DAEMON)
+DAEMON_OPTS="--background $DAEMON_OPTS"
+
+case "$1" in
+ start)
+ stat_busy "Starting ${0##*/} daemon"
+ [[ ! $PID ]] && $DAEMON $DAEMON_OPTS && add_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ stop)
+ stat_busy "Stopping ${0##*/} daemon"
+ [[ $PID ]] && kill $PID &> /dev/null && rm_daemon ${0##*/} && stat_done && exit 0
+ stat_fail
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit 0
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ ;;
+esac
+
+exit 1
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/stunnel/stunnel.rc.d b/src/stunnel/stunnel.rc.d
new file mode 100755
index 0000000..76f7b79
--- /dev/null
+++ b/src/stunnel/stunnel.rc.d
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+pidfile=/var/run/stunnel/stunnel.pid
+if [[ -r $pidfile ]]; then
+ read -r PID < "$pidfile"
+ if [[ $PID && ! -d /proc/$PID ]]; then
+ # stale pidfile
+ unset PID
+ rm -f "$pidfile"
+ fi
+fi
+
+case "$1" in
+ start)
+ stat_busy "Starting stunnel"
+ if [[ -z $PID ]] && /usr/bin/stunnel; then
+ add_daemon stunnel
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping stunnel"
+ if [[ $PID ]] && kill $PID &>/dev/null; then
+ rm_daemon stunnel
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/subversion/svnserve b/src/subversion/svnserve
new file mode 100755
index 0000000..670fee7
--- /dev/null
+++ b/src/subversion/svnserve
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/svnserve
+
+PID=`pidof -o %PPID /usr/bin/svnserve`
+case "$1" in
+ start)
+ stat_busy "Starting svnserve"
+ if [ -z "$PID" ]; then
+ if [ -n "$SVNSERVE_USER" ]; then
+ su -s '/bin/sh' $SVNSERVE_USER -c "/usr/bin/svnserve -d $SVNSERVE_ARGS" &
+ else
+ /usr/bin/svnserve -d $SVNSERVE_ARGS &
+ fi
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon svnserve
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping svnserve"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon svnserve
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/supervisor/supervisord b/src/supervisor/supervisord
new file mode 100755
index 0000000..3037437
--- /dev/null
+++ b/src/supervisor/supervisord
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PIDFILE=/run/supervisord.pid
+
+getPID() {
+ local PID
+ [ -f "$PIDFILE" ] || return
+ PID=$(cat "$PIDFILE" 2>/dev/null)
+ if [ -d "/proc/$PID" ]; then
+ echo $PID
+ else
+ rm -f "$PIDFILE" &>/dev/null
+ fi
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting Supervisor Daemon"
+ if [ -z "$(getPID)" ]; then
+ /usr/bin/supervisord -j "$PIDFILE" -c /etc/supervisord.conf &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon supervisord
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping Supervisor Daemon"
+ if [ ! -z "$(getPID)" ]; then
+ timeo=30
+ kill $(getPID) &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ fi
+ while [ ! -z "$(getPID)" -a $timeo -gt 0 ]; do
+ sleep 1
+ let timeo=${timeo}-1
+ done
+ if [ -z "$(getPID)" ]; then
+ rm_daemon supervisor
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ $0 start
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/synergy/synergys.rc b/src/synergy/synergys.rc
new file mode 100755
index 0000000..8f19dc5
--- /dev/null
+++ b/src/synergy/synergys.rc
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+daemon_name=synergys
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/synergys`
+case "$1" in
+ start)
+ stat_busy "Starting Synergy Server"
+ [ -z "$PID" ] && /usr/bin/synergys --config /etc/synergy.conf &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Synergy Server"
+ [ ! -z "$PID" ] && kill -9 $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/syslog-ng/syslog-ng.rc b/src/syslog-ng/syslog-ng.rc
new file mode 100755
index 0000000..d48b71e
--- /dev/null
+++ b/src/syslog-ng/syslog-ng.rc
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/syslog-ng
+
+checkconfig() {
+ if ! syslog-ng -s "${SYSLOG_NG_CHECKOPTS[@]}"; then
+ stat_fail
+ exit 1
+ fi
+}
+
+pidfile=/run/syslog-ng.pid
+if [[ -r $pidfile ]]; then
+ read -r PID < "$pidfile"
+ if [[ $PID && ! -d /proc/$PID ]]; then
+ # stale pidfile
+ unset PID
+ rm -f "$pidfile"
+ fi
+fi
+
+case $1 in
+ start)
+ stat_busy "Starting Syslog-NG"
+ checkconfig
+ if [[ -z $PID ]] && /usr/sbin/syslog-ng "${SYSLOG_NG_OPTS[@]}"; then
+ add_daemon syslog-ng
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Syslog-NG"
+ if [[ $PID ]] && kill $PID &>/dev/null; then
+ rm_daemon syslog-ng
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ reload)
+ stat_busy "Reloading Syslog-NG configuration and re-opening log files"
+ if [[ -z $PID ]]; then
+ stat_fail
+ else
+ checkconfig
+ if kill -HUP $PID &>/dev/null; then
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|reload}"
+esac
diff --git a/src/sysstat/sysstat b/src/sysstat/sysstat
new file mode 100755
index 0000000..d0e40aa
--- /dev/null
+++ b/src/sysstat/sysstat
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+. /etc/rc.d/functions
+. /etc/conf.d/sysstat
+. /etc/rc.conf
+
+case "$1" in
+ start)
+ stat_busy "Writing SysStat restart record"
+ /usr/lib/sa/sadc -L -F ${SADC_OPTIONS} -
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon sysstat
+ stat_done
+ fi
+ ;;
+ stop)
+ echo "Stopping SysStat is useless"
+ rm_daemon sysstat
+ ;;
+ *)
+ echo "usage: $0 {start|stop}"
+esac
+exit 0
diff --git a/src/tenshi/rc-script b/src/tenshi/rc-script
new file mode 100755
index 0000000..2ce96f0
--- /dev/null
+++ b/src/tenshi/rc-script
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+# source application-specific settings
+[ -f /etc/conf.d/tenshi ] && . /etc/conf.d/tenshi
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`cat $TENSHI_PID 2>/dev/null`
+
+start() {
+ stat_busy "Starting Tenshi log monitor"
+ [ -z "$PID" ] && /usr/sbin/tenshi $TENSHI_OPTIONS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon tenshi
+ stat_done
+ fi
+}
+
+stop() {
+ stat_busy "Stopping Tenshi log monitor"
+ [ ! -z "$PID" ] && kill $PID
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f $TENSHI_PID
+ rm_daemon tenshi
+ stat_done
+ fi
+}
+
+reload() {
+ stat_busy "Reloading Tenshi log monitor"
+ [ ! -z "$PID" ] && kill -HUP $PID
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ # calling 'stop' and 'start' without the $0 fails...
+ $0 stop
+ $0 start
+ ;;
+ reload)
+ reload
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|reload}"
+esac
+exit 0
diff --git a/src/tftp-hpa/tftpd.rc b/src/tftp-hpa/tftpd.rc
new file mode 100755
index 0000000..0222d16
--- /dev/null
+++ b/src/tftp-hpa/tftpd.rc
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+TFTPD_ARGS=
+[ -f /etc/conf.d/tftpd ] && . /etc/conf.d/tftpd
+
+PID=$(pidof -o %PPID /usr/sbin/in.tftpd)
+case "$1" in
+ start)
+ stat_busy "Starting TFTPD"
+ [ -z "$PID" ] && /usr/sbin/in.tftpd ${TFTPD_ARGS}
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon tftpd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping TFTPD"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon tftpd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/timidity++/timidity++.sh b/src/timidity++/timidity++.sh
new file mode 100755
index 0000000..3fa13ce
--- /dev/null
+++ b/src/timidity++/timidity++.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/timidity`
+case "$1" in
+ start)
+ stat_busy "Starting Timidity++ ALSA Daemon"
+ [ -z "$PID" ] && /usr/bin/timidity -iAD > /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo $PID > /var/run/timidity.pid
+ add_daemon timidity++
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Timidity++ ALSA Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm /var/run/timidity.pid
+ rm_daemon timidity++
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/tinc/tincd.rc b/src/tinc/tincd.rc
new file mode 100755
index 0000000..48c132f
--- /dev/null
+++ b/src/tinc/tincd.rc
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+daemon_name=tincd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/$daemon_name.conf
+
+case "$1" in
+ start)
+ for net in "${NETNAMES[@]}"; do
+ stat_busy "Starting ${daemon_name}"
+ /usr/sbin/tincd -n "${net}" $TINCD_EXTRAOPTS &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ${daemon_name}
+ stat_done
+ fi
+ done
+ ;;
+ stop)
+ stat_busy "Stopping ${daemon_name}"
+ for net in "${NETNAMES[@]}"; do
+ /usr/sbin/tincd -k -n "${net}" &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ${daemon_name}
+ stat_done
+ fi
+ done
+ ;;
+ restart)
+ "$0" stop
+ sleep 5
+ "$0" start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/tinyproxy/tinyproxy b/src/tinyproxy/tinyproxy
new file mode 100755
index 0000000..5580ea8
--- /dev/null
+++ b/src/tinyproxy/tinyproxy
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=$(pidof -o %PPID /usr/sbin/tinyproxy)
+
+start() {
+ stat_busy "Starting Tinyproxy"
+
+ [ -z "$PID" ] && rm -f /var/run/tinyproxy/tinyproxy.pid && \
+ /usr/sbin/tinyproxy -c /etc/tinyproxy/tinyproxy.conf 2>/dev/null
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon tinyproxy
+ stat_done
+ fi
+}
+
+stop() {
+ stat_busy "Stopping Tinyproxy"
+
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon tinyproxy
+ stat_done
+ fi
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/tomcat6/tomcat6 b/src/tomcat6/tomcat6
new file mode 100755
index 0000000..dc5615d
--- /dev/null
+++ b/src/tomcat6/tomcat6
@@ -0,0 +1,77 @@
+#!/bin/bash
+
+daemon_name=tomcat6
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${daemon_name}
+
+case "$1" in
+ start)
+ stat_busy "Starting ${daemon_name} daemon"
+
+ PID=$(get_pid 'jsvc.exec')
+ if [ -z "$PID" ]; then
+ [ -f /var/run/${daemon_name}.pid ] && rm -f /var/run/${daemon_name}.pid
+ # RUN
+ /usr/bin/jsvc \
+ -Dcatalina.home=${CATALINA_HOME} \
+ -Dcatalina.base=${CATALINA_BASE} \
+ -Djava.io.tmpdir=/var/tmp/tomcat6/temp \
+ -cp /usr/share/java/commons-daemon.jar:/usr/share/java/eclipse-ecj.jar:${CATALINA_HOME}/bin/bootstrap.jar:${CATALINA_HOME}/bin/tomcat-juli.jar \
+ -user tomcat \
+ -java-home ${TOMCAT_JAVA_HOME} \
+ -wait 10 \
+ -pidfile /var/run/${daemon_name}.pid \
+ -errfile /var/log/tomcat6/catalina.err \
+ -outfile /var/log/tomcat6/catalina.out \
+ ${CATALINA_OPTS} \
+ org.apache.catalina.startup.Bootstrap
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon ${daemon_name}
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping ${daemon_name} daemon"
+ # STOP
+ /usr/bin/jsvc \
+ -pidfile /var/run/${daemon_name}.pid \
+ -stop \
+ org.apache.catalina.startup.Bootstrap
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/${daemon_name}.pid &> /dev/null
+ rm_daemon ${daemon_name}
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking ${daemon_name} status";
+ ck_status ${daemon_name}
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/src/tomcat7/tomcat7 b/src/tomcat7/tomcat7
new file mode 100755
index 0000000..dbb5360
--- /dev/null
+++ b/src/tomcat7/tomcat7
@@ -0,0 +1,77 @@
+#!/bin/bash
+
+daemon_name=tomcat7
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${daemon_name}
+
+case "$1" in
+ start)
+ stat_busy "Starting ${daemon_name} daemon"
+
+ PID=$(get_pid 'jsvc.exec')
+ if [ -z "$PID" ]; then
+ [ -f /var/run/${daemon_name}.pid ] && rm -f /var/run/${daemon_name}.pid
+ # RUN
+ /usr/bin/jsvc \
+ -Dcatalina.home=${CATALINA_HOME} \
+ -Dcatalina.base=${CATALINA_BASE} \
+ -Djava.io.tmpdir=/var/tmp/tomcat7/temp \
+ -cp /usr/share/java/commons-daemon.jar:/usr/share/java/eclipse-ecj.jar:${CATALINA_HOME}/bin/bootstrap.jar:${CATALINA_HOME}/bin/tomcat-juli.jar \
+ -user tomcat \
+ -java-home ${TOMCAT_JAVA_HOME} \
+ -wait 10 \
+ -pidfile /var/run/${daemon_name}.pid \
+ -errfile /var/log/tomcat7/catalina.err \
+ -outfile /var/log/tomcat7/catalina.out \
+ ${CATALINA_OPTS} \
+ org.apache.catalina.startup.Bootstrap
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon ${daemon_name}
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping ${daemon_name} daemon"
+ # STOP
+ /usr/bin/jsvc \
+ -pidfile /var/run/${daemon_name}.pid \
+ -stop \
+ org.apache.catalina.startup.Bootstrap
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/${daemon_name}.pid &> /dev/null
+ rm_daemon ${daemon_name}
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking ${daemon_name} status";
+ ck_status ${daemon_name}
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/src/tor/tor b/src/tor/tor
new file mode 100755
index 0000000..522c498
--- /dev/null
+++ b/src/tor/tor
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+# source application-specific settings
+[ -f /etc/conf.d/tor ] && . /etc/conf.d/tor
+
+PID=`pidof -o %PPID /usr/bin/tor`
+case "$1" in
+ start)
+ stat_busy "Starting Tor Daemon"
+ if [ -z "${TOR_MAX_FD}" ] || ulimit -n "${TOR_MAX_FD}"; then
+ [ -z "$PID" ] && /usr/bin/tor -f ${TOR_CONF} ${TOR_ARGS} &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon tor
+ stat_done
+ fi
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Tor Daemon"
+ [ ! -z "$PID" ] && kill -INT $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon tor
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
+# vim: ft=sh ts=2 sw=2
diff --git a/src/trac/tracd b/src/trac/tracd
new file mode 100755
index 0000000..2b07fcf
--- /dev/null
+++ b/src/trac/tracd
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+. /etc/conf.d/tracd.conf
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+DAEMON_NAME=tracd
+
+if [ -z "$PORT" ]; then
+ PORT="-p 8080"
+else
+ PORT="-p $PORT"
+fi
+
+if [ -z "$AUTH" ]; then
+ AUTH=
+else
+ AUTH="--auth ${AUTH//;/ --auth }"
+fi
+
+case "$1" in
+ start)
+ if [ -z "$PROJECT" ]; then
+ echo "You need to set the project path in /etc/conf.d/${DAEMON_NAME}.conf"
+ exit 1
+ fi
+ stat_busy "Starting $DAEMON_NAME: "
+ tracd -d $HOSTNAME $PORT $AUTH $PROJECT
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon $DAEMON_NAME
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Shutting down $DAEMON_NAME: "
+ kill `ps ax|grep pyth|grep tracd|awk -- "{print \\$1;}"`
+ rm_daemon $DAEMON_NAME
+ stat_done
+ ;;
+ reload|restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload}"
+esac
diff --git a/src/transmission/transmissiond b/src/transmission/transmissiond
new file mode 100755
index 0000000..ea3d770
--- /dev/null
+++ b/src/transmission/transmissiond
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/transmissiond
+
+PID=`pidof -o %PPID /usr/bin/transmission-daemon`
+case "$1" in
+ start)
+ stat_busy "Starting Transmission Daemon"
+ [ -z "$PID" ] && su -l -s /bin/sh -c "/usr/bin/transmission-daemon $TRANS_ARGS" "${TRANS_USER:-transmission}"
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon transmissiond
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Transmission Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon transmissiond
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ while [ ! -z "$PID" -a -d "/proc/$PID" ]; do sleep 1; done
+ $0 start
+ ;;
+ reload)
+ stat_busy "Reloading config"
+ [ ! -z "$PID" ] && kill -HUP $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|reload}"
+esac
+exit 0
diff --git a/src/ucarp/ucarp.rc b/src/ucarp/ucarp.rc
new file mode 100755
index 0000000..f8c9d54
--- /dev/null
+++ b/src/ucarp/ucarp.rc
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+NAME=ucarp
+DAEMON=/usr/sbin/ucarp
+PID=$(pidof -o %PPID $DAEMON)
+DAEMON_OPTS="--daemonize $DAEMON_OPTS"
+
+case "$1" in
+ start)
+ stat_busy "Starting $NAME daemon"
+ [[ ! $PID ]] && $DAEMON $DAEMON_OPTS && add_daemon $NAME && stat_done && exit 0
+ stat_fail
+ ;;
+ stop)
+ stat_busy "Stopping $NAME daemon"
+ [[ $PID ]] && kill $PID &> /dev/null && rm_daemon $NAME && stat_done && exit 0
+ stat_fail
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ exit 0
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart}" >&2
+ ;;
+esac
+
+exit 1
+
+# vim:set ts=2 sw=2 ft=sh noet:
diff --git a/src/ufw/rc.d b/src/ufw/rc.d
new file mode 100755
index 0000000..bd8c3e3
--- /dev/null
+++ b/src/ufw/rc.d
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+[ -x /usr/bin/ufw ] || exit 0
+
+for s in "/usr/lib/ufw/ufw-init-functions" "/etc/ufw/ufw.conf" ; do
+ if [ -s "$s" ]; then
+ . "$s"
+ else
+ echo "Could not find $s (aborting)"
+ exit 1
+ fi
+done
+
+error=0
+case "$1" in
+start)
+ if [ "$ENABLED" = "yes" ] || [ "$ENABLED" = "YES" ]; then
+ stat_busy "Starting ufw"
+ if ! ufw_start; then
+ stat_fail
+ else
+ add_daemon ufw
+ stat_done
+ fi
+
+ else
+ echo "Skip starting firewall:" "ufw (not enabled)"
+ fi
+ ;;
+stop)
+ if [ "$ENABLED" = "yes" ] || [ "$ENABLED" = "YES" ]; then
+ stat_busy "Stopping ufw"
+ if ! ufw_stop; then
+ stat_fail
+ else
+ rm_daemon ufw
+ stat_done
+ fi
+ else
+ echo "Skip stopping firewall:" "ufw (not enabled)"
+ fi
+ ;;
+restart|force-reload)
+ stat_busy "Reloading ufw"
+ if ! ufw_reload; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+status)
+ ufw_status
+ ;;
+*)
+ echo "Usage: /etc/rc.d/ufw {start|stop|restart|force-reload|status}"
+ exit 1
+ ;;
+esac
+
+exit 0
+
diff --git a/src/ulogd/ulogd.rc b/src/ulogd/ulogd.rc
new file mode 100755
index 0000000..83f0550
--- /dev/null
+++ b/src/ulogd/ulogd.rc
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ pidof /usr/sbin/ulogd
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting ulogd daemon"
+
+ [ -f /var/run/ulog.pid ] && rm -f /var/run/ulog.pid
+ PID=`get_pid`
+ if [ -z "$PID" ]; then
+ /usr/sbin/ulogd -d &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo `get_pid` > /var/run/ulogd.pid
+ add_daemon ulogd
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping ulog daemon"
+ PID=`get_pid`
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/ulogd.pid &> /dev/null
+ rm_daemon ulogd
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/ultimate-ircd/ultimate-ircd b/src/ultimate-ircd/ultimate-ircd
new file mode 100755
index 0000000..df73d73
--- /dev/null
+++ b/src/ultimate-ircd/ultimate-ircd
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ pidof /usr/bin/ircd
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting Ultimate IRCd"
+
+ [ -d /var/run/ircd ] || mkdir -p /var/run/ircd
+ [ -f /var/run/ircd/ircd.pid ] && rm -f /var/run/ircd/ircd.pid
+ PID=`get_pid`
+ if [ -z "$PID" ]; then
+ su -c '/usr/bin/ircd -f /etc/ircd/ircd.conf' ircd 1>>/var/log/ircd/stdout.log 2>>/var/log/ircd/sterr.log
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon ultimate-ircd
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping Ultimate IRCd"
+ PID=`get_pid`
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/ircd/ircd.pid &> /dev/null
+ rm_daemon ultimate-ircd
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/unbound/rc.d b/src/unbound/rc.d
new file mode 100755
index 0000000..b5b6466
--- /dev/null
+++ b/src/unbound/rc.d
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+name=unbound
+prog="/usr/sbin/unbound"
+
+PID=$(pidof -o %PPID $prog)
+
+case "$1" in
+start)
+ stat_busy "Starting $name daemon"
+ [[ -z "$PID" ]] && eval $prog &>/dev/null \
+ && { add_daemon $name; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+stop)
+ stat_busy "Stopping $name daemon"
+ [[ -n "$PID" ]] && kill $PID &>/dev/null \
+ && { rm_daemon $name; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+reload)
+ stat_busy "Reloading $name daemon"
+ [[ -n "$PID" ]] && kill -SIGHUP $PID &>/dev/null \
+ && { stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+*)
+ echo "usage: $0 {start|stop|restart|reload}"
+ exit 1
+ ;;
+esac
diff --git a/src/unrealircd/unrealircd.rc b/src/unrealircd/unrealircd.rc
new file mode 100755
index 0000000..2cede46
--- /dev/null
+++ b/src/unrealircd/unrealircd.rc
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+daemon_name=unrealircd
+
+. /etc/conf.d/unrealircd
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ pidof ircd unrealircd
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name daemon"
+
+ PID=`get_pid`
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
+ # RUN
+ export PID_FILE="/var/run/unrealircd.pid"
+ su -c /usr/bin/unrealircd -p - $UNREALIRCD_USER 1>>/var/log/unrealircd/ircd.log 2>>/var/log/unrealircd/ircd.log
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo `get_pid` > /var/run/$daemon_name.pid
+ add_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ PID=`get_pid`
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/$daemon_name.pid &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/uptimed/rc.d b/src/uptimed/rc.d
new file mode 100755
index 0000000..6fe9ec3
--- /dev/null
+++ b/src/uptimed/rc.d
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/uptimed`
+case "$1" in
+ start)
+ stat_busy "Starting Uptimed Daemon"
+ [ -z "$PID" ] && /usr/sbin/uptimed -b # create the boot record
+ if [ $? -gt 0 ] ; then
+ stat_fail
+ else
+ add_daemon uptimed # create the 'state' dir
+ /usr/sbin/uptimed # fire up the daemon
+ if [ $? -gt 0 ]; then
+ stat_fail
+ fi
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Uptimed Daemon"
+ [ "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon uptimed # remove the 'state' dir
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/usermin/usermin.rc b/src/usermin/usermin.rc
new file mode 100755
index 0000000..af36578
--- /dev/null
+++ b/src/usermin/usermin.rc
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+start=/etc/usermin/start
+stop=/etc/usermin/stop
+lockfile=/var/lock/usermin
+
+case "$1" in
+'start')
+ stat_busy "Starting Usermin daemon"
+ $start >/dev/null 2>&1 </dev/null
+ RETVAL=$?
+ if [ "$RETVAL" = "0" ]; then
+ touch $lockfile >/dev/null 2>&1
+ stat_done
+ else
+ stat_fail
+fi
+;;
+
+'stop')
+ stat_busy "Stopping Usermin daemon"
+ $stop >/dev/null 2>&1 </dev/null
+ RETVAL=$?
+ if [ "$RETVAL" = "0" ]; then
+ rm -f $lockfile
+ stat_done
+ else
+ stat_fail
+fi
+;;
+
+'restart')
+ $stop && $start
+ RETVAL=$?
+;;
+*)
+echo "Usage: $0 { start | stop | restart }"
+RETVAL=1
+;;
+esac
+exit $RETVAL \ No newline at end of file
diff --git a/src/ushare/ushare b/src/ushare/ushare
new file mode 100755
index 0000000..b545b85
--- /dev/null
+++ b/src/ushare/ushare
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+DESC="uShare UPnP A/V Media Server"
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+[ -r "/etc/ushare/ushare.conf" ] && . /etc/ushare/ushare.conf
+[ -r "/etc/conf.d/ushare" ] && . /etc/conf.d/ushare
+
+[ -z $USHARE_USER ] && USHARE_USER=ushare
+
+# abort if no executable exists
+#[ -x $DAEMON ] || stat_fail
+
+# abort if no shared directory is defined
+#[ -z "$USHARE_DIR" ] && stat_fail
+
+#set -e
+
+#checkpid() {
+# [ -e $PIDFILE ] || touch $PIDFILE
+#}
+
+PID=`pidof -o %PPID /usr/bin/ushare`
+case "$1" in
+ start)
+ stat_busy "Starting $DESC"
+ [ -z "$PID" ] && sudo -u $USHARE_USER /usr/bin/ushare -D -x $PARAMS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ PID=`pidof -o %PPID /usr/bin/ushare`
+ echo $PID > /var/run/ushare.pid
+ add_daemon ushare
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping $DESC"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm /var/run/ushare.pid
+ rm_daemon ushare
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/varnish/rc.varnish b/src/varnish/rc.varnish
new file mode 100755
index 0000000..352f07d
--- /dev/null
+++ b/src/varnish/rc.varnish
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/varnish
+
+pidfile=/run/varnish.pid
+if [[ -r $pidfile ]]; then
+ read -r PID < "$pidfile"
+ if [[ ! -d /proc/$PID ]]; then
+ # stale pidfile
+ unset PID
+ rm -f "$pidfile"
+ fi
+fi
+
+case $1 in
+ start)
+ stat_busy "Starting Varnish Reverse Proxy"
+ if /usr/sbin/varnishd $VARNISHD_OPTS -P "$pidfile"; then
+ add_daemon varnish
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Varnish Reverse Proxy"
+ if [[ $PID ]] && kill $PID &>/dev/null; then
+ rm_daemon varnish
+ stat_done
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ reload)
+ status "Recompiling and Reloading VCL" varnish-vcl-reload $VARNISH_CFG
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|reload}"
+ ;;
+esac
diff --git a/src/vde2/vde.rc b/src/vde2/vde.rc
new file mode 100755
index 0000000..b368f99
--- /dev/null
+++ b/src/vde2/vde.rc
@@ -0,0 +1,113 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/vde
+
+case "$1" in
+ start)
+ # bring up all defined profiles
+ for i in $VDE_CONFIG; do
+ [ -e /etc/vde/$i ] && . /etc/vde/$i
+ stat_busy "Starting vde_switch $i"
+ # get options from profile
+ [ -n "$VDE_NUMPORTS" ] && OPTIONS="-n $VDE_NUMPORTS"
+ [ "$VDE_HUB" = "yes" ] && OPTIONS="$OPTIONS -x"
+ [ "$VDE_FSTP" = "yes" ] && OPTIONS="$OPTIONS -F"
+ [ -n "$VDE_MAC" ] && OPTIONS="$OPTIONS --macaddr $VDE_MAC"
+ [ -n "$VDE_PRIORITY" ] && OPTIONS="$OPTIONS --priority $VDE_PRIORITY"
+ [ -n "$VDE_HASH" ] && OPTIONS="$OPTIONS --hashsize $VDE_HASH"
+ [ -n "$VDE_SOCK" ] && OPTIONS="$OPTIONS -s $VDE_SOCK"
+ [ -n "$VDE_SOCK_MODE" ] && OPTIONS="$OPTIONS -m $VDE_SOCK_MODE"
+ [ -n "$VDE_SOCK_GROUP" ] && OPTIONS="$OPTIONS -g $VDE_SOCK_GROUP"
+ [ -n "$VDE_MANAGEMENT_SOCK" ] && OPTIONS="$OPTIONS -M $VDE_MANAGEMENT_SOCK"
+ [ -n "$VDE_MANAGEMENT_SOCK_MODE" ] && OPTIONS="$OPTIONS --mgmtmode $VDE_MANAGEMENT_SOCK_MODE"
+ [ -n "$VDE_TAP" ] && OPTIONS="$OPTIONS -t $VDE_TAP"
+ [ -n "$VDE_OPTIONS" ] && OPTIONS="$OPTIONS $VDE_OPTIONS"
+ vde_switch $OPTIONS -p /var/run/vde-$i.pid -daemon &>/dev/null
+ [ -n "$VDE_SOCK" -a -n "$VDE_SOCK_GROUP" ] && chgrp "$VDE_SOCK_GROUP" "$VDE_SOCK"
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ if [ "$SLIRP" = "yes" ]; then
+ stat_busy "Starting slirpvde for $i"
+ [ "$SLIRP_DHCP" = "yes" ] && SP_OPTIONS="-D"
+ [ -n "$SLIRP_NETWORK" ] && SP_OPTIONS="$SP_OPTIONS -n $SLIRP_NETWORK"
+ [ -n "$SLIRP_OPTIONS" ] && SP_OPTIONS="$SP_OPTIONS $SLIRP_OPTIONS"
+ [ -n "$VDE_SOCK" ] && SP_OPTIONS="$SP_OPTIONS -s $VDE_SOCK"
+ [ -n "$VDE_SOCK_MODE" ] && SP_OPTIONS="$SP_OPTIONS -m $VDE_SOCK_MODE"
+ [ -n "$VDE_SOCK_GROUP" ] && SP_OPTIONS="$SP_OPTIONS -g $VDE_SOCK_GROUP"
+ slirpvde $SP_OPTIONS -p /var/run/slirpvde-$i.pid -daemon &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ unset OPTIONS
+ unset SP_OPTIONS
+ fi
+ done
+ for i in $VDE_CONNECTION; do
+ # connect specified vde_switches
+ if [ "$(grep ^vde_plug /etc/vde/$i)" ]; then
+ stat_busy "Connecting VDE switches $i together..."
+ while read j; do
+ switch="$(echo $j | grep ^vde_plug)"
+ [ -n "$switch" ] && (dpipe $switch &)
+ done </etc/vde/$i
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ fi
+ done
+ add_daemon vde
+ ;;
+ stop)
+ # kill vde_plug if switches are connected
+ [ -n "$VDE_CONNECTION" ] && killall vde_plug >/dev/null 2>&1
+ for i in $VDE_CONFIG; do
+ [ -e /etc/vde/$i ] && . /etc/vde/$i
+ if [ "$SLIRP" = "yes" ]; then
+ stat_busy "Stopping slirpvde for $i"
+ kill $(cat /var/run/slirpvde-$i.pid) &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ rm /var/run/slirpvde-$i.pid &> /dev/null
+ fi
+ stat_busy "Stopping vde_switch $i"
+ kill $(cat /var/run/vde-$i.pid) &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ rm /var/run/vde-$i.pid &> /dev/null
+ stat_busy "Removing $i vde sockets"
+ rm -rf $VDE_SOCK $VDE_MANAGEMENT_SOCK
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ done
+ unset OPTIONS
+ unset SP_OPTIONS
+ [ -e /var/run/vde/gmon.out ] && rm /var/run/vde/gmon.out
+ rm_daemon vde
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/virtualbox/vboxservice.rc b/src/virtualbox/vboxservice.rc
new file mode 100755
index 0000000..5a62d69
--- /dev/null
+++ b/src/virtualbox/vboxservice.rc
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/${0##*/}
+
+name=VBoxService
+PID=$(pidof -o %PPID $name)
+
+case "$1" in
+ start)
+ stat_busy 'Starting VirtualBox Guest Service'
+ [[ -z "$PID" ]] && ${name} $VBOX_SERVICE_OPTION &>/dev/null \
+ && { add_daemon ${0##*/}; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+ stop)
+ stat_busy 'Stopping VirtualBox Guest Service'
+ [[ -n "$PID" ]] && kill $PID &>/dev/null \
+ && { rm_daemon ${0##*/}; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ status)
+ stat_busy 'Checking VirtualBox Guest Service status'
+ ck_status ${0##*/}
+ ;;
+ *)
+ echo "usage: ${0##*/} {start|stop|restart|status}" >&2
+ exit 1
+esac
+
+exit 0
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/virtualbox/vboxweb.rc b/src/virtualbox/vboxweb.rc
new file mode 100755
index 0000000..97273e3
--- /dev/null
+++ b/src/virtualbox/vboxweb.rc
@@ -0,0 +1,86 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/vbox/vbox.cfg
+. /etc/conf.d/vboxweb
+
+BINARY="$INSTALL_DIR/vboxwebsrv"
+
+start() {
+ stat_busy "Starting VirtualBox Web Service";
+ if ! pidof -o %PPID $BINARY >/dev/null; then
+ [[ "$VBOXWEB_USER" ]] || stat_die
+ lsmod | grep -q "vboxdrv[^_-]" || stat_die
+ PARAMS="--background"
+ [[ "$VBOXWEB_HOST" ]] && PARAMS+=" -H $VBOXWEB_HOST"
+ [[ "$VBOXWEB_PORT" ]] && PARAMS+=" -p $VBOXWEB_PORT"
+ [[ "$VBOXWEB_TIMEOUT" ]] && PARAMS+=" -t $VBOXWEB_TIMEOUT"
+ [[ "$VBOXWEB_CHECK_INTERVAL" ]] && PARAMS+=" -i $VBOXWEB_CHECK_INTERVAL"
+ [[ "$VBOXWEB_THREADS" ]] && PARAMS+=" -T $VBOXWEB_THREADS"
+ [[ "$VBOXWEB_KEEPALIVE" ]] && PARAMS+=" -k $VBOXWEB_KEEPALIVE"
+ [[ "$VBOXWEB_LOGFILE" ]] && PARAMS+=" -F $VBOXWEB_LOGFILE"
+ # prevent inheriting this setting to VBoxSVC
+ unset VBOX_RELEASE_LOG_DEST
+ su - $VBOXWEB_USER -c "$BINARY $PARAMS" &>/dev/null
+ # ugly: wait until the final process has forked
+ sleep .2
+ if pidof -o %PPID $BINARY >/dev/null; then
+ add_daemon vboxweb
+ stat_done
+ else
+ stat_die
+ fi
+ else
+ stat_die
+ fi
+}
+
+stop() {
+ stat_busy "Stopping VirtualBox Web Service"
+ PID=$(pidof -o %PPID $BINARY)
+ [[ $PID ]] && kill $PID &>/dev/null
+ if ! pidof -o %PPID $BINARY >/dev/null; then
+ rm_daemon vboxweb
+ stat_done
+ else
+ stat_die
+ fi
+}
+
+restart() {
+ stop && start
+}
+
+status() {
+ stat_busy "Checking for VirtualBox Web Service"
+ if pidof -o %PPID $BINARY >/dev/null; then
+ stat_done
+ else
+ stat_fail
+ false
+ fi
+}
+
+case "$1" in
+start)
+ start
+ ;;
+stop)
+ stop
+ ;;
+restart)
+ restart
+ ;;
+force-reload)
+ restart
+ ;;
+status)
+ status
+ ;;
+*)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+esac
+
+# vim:set ts=2 sw=2 ft=sh et:
diff --git a/src/vsftpd/vsftpd.d b/src/vsftpd/vsftpd.d
new file mode 100755
index 0000000..2731085
--- /dev/null
+++ b/src/vsftpd/vsftpd.d
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+daemon_name=vsftpd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ pidof -o %PPID $daemon_name
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting $daemon_name daemon"
+
+ PID=$(get_pid)
+ if [ -z "$PID" ]; then
+ [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
+ # RUN
+ $daemon_name &
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ echo $(get_pid) > /var/run/$daemon_name.pid
+ add_daemon $daemon_name
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping $daemon_name daemon"
+ PID=$(get_pid)
+ # KILL
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ #
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/$daemon_name.pid &> /dev/null
+ rm_daemon $daemon_name
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+
+ status)
+ stat_busy "Checking $daemon_name status";
+ ck_status $daemon_name
+ ;;
+
+ *)
+ echo "usage: $0 {start|stop|restart|status}"
+esac
+
+exit 0
diff --git a/src/watchdog/watchdog.sh b/src/watchdog/watchdog.sh
new file mode 100755
index 0000000..54f7845
--- /dev/null
+++ b/src/watchdog/watchdog.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID="$( cat /run/watchdog.pid 2>/dev/null )"
+[ -r /etc/conf.d/watchdog ] && source /etc/conf.d/watchdog
+
+case "$1" in
+ start)
+ stat_busy "Starting Watchdog Daemon"
+
+ [ -z "$PID" ] && /usr/sbin/watchdog ${WATCHDOG_OPTIONS}
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon watchdog
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Watchdog Daemon"
+
+ [ -n "$PID" ] && kill $PID &> /dev/null
+
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon watchdog
+ stat_done
+ fi
+
+ rm -f /run/watchdog.pid
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/webfs/webfsd.rc b/src/webfs/webfsd.rc
new file mode 100755
index 0000000..1c854eb
--- /dev/null
+++ b/src/webfs/webfsd.rc
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# source application-specific settings
+[ -f /etc/conf.d/webfsd ] && . /etc/conf.d/webfsd
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID webfsd`
+case "$1" in
+ start)
+ stat_busy "Starting webfsd"
+ [ -z "$PID" ] && /usr/bin/webfsd ${WEBFSD_ARGS} &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon webfsd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping webfsd"
+ [ ! -z "$PID" ] && kill $PID &>/dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon webfsd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/webmin/webmin.rc b/src/webmin/webmin.rc
new file mode 100755
index 0000000..6aac894
--- /dev/null
+++ b/src/webmin/webmin.rc
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+start=/etc/webmin/start
+stop=/etc/webmin/stop
+lockfile=/var/lock/webmin
+
+case "$1" in
+'start')
+ stat_busy "Starting Webmin daemon"
+ $start >/dev/null 2>&1 </dev/null
+ RETVAL=$?
+ if [ "$RETVAL" = "0" ]; then
+ touch $lockfile >/dev/null 2>&1
+ add_daemon webmin
+ stat_done
+ else
+ stat_fail
+fi
+;;
+
+'stop')
+ stat_busy "Stopping Webmin daemon"
+ $stop >/dev/null 2>&1 </dev/null
+ RETVAL=$?
+ if [ "$RETVAL" = "0" ]; then
+ rm -f $lockfile
+ rm_daemon webmin
+ stat_done
+ else
+ stat_fail
+fi
+;;
+
+'restart')
+ $0 stop
+ $0 start
+;;
+*)
+echo "Usage: $0 { start | stop | restart }"
+RETVAL=1
+;;
+esac
+exit $RETVAL \ No newline at end of file
diff --git a/src/wesnoth/wesnothd.rc.d b/src/wesnoth/wesnothd.rc.d
new file mode 100755
index 0000000..95e312b
--- /dev/null
+++ b/src/wesnoth/wesnothd.rc.d
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=$(pidof -o %PPID /usr/bin/wesnothd)
+
+case "$1" in
+ start)
+ stat_busy "Starting Wesnoth Server Daemon"
+ [[ -d /var/run/wesnothd ]] || mkdir /var/run/wesnothd
+ [ -z "$PID" ] && /usr/bin/wesnothd -d &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ PID=$(pidof -o %PPID /usr/bin/wesnothd)
+ echo $PID > /var/run/wesnotd/pid
+ add_daemon wesnothd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Wesnoth Server Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon wesnothd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/wicd/wicd-daemon b/src/wicd/wicd-daemon
new file mode 100755
index 0000000..a75c380
--- /dev/null
+++ b/src/wicd/wicd-daemon
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+case "$1" in
+ start)
+ stat_busy "Starting wicd Daemon"
+ pkill -f wicd-daemon.py &> /dev/null
+ /usr/sbin/wicd &> /dev/null
+ add_daemon wicd
+ stat_done
+ ;;
+ stop)
+ stat_busy "Stopping wicd Daemon"
+ pkill -f wicd-daemon.py &> /dev/null
+ rm_daemon wicd
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/x11vnc/rc.d b/src/x11vnc/rc.d
new file mode 100755
index 0000000..b5f2a64
--- /dev/null
+++ b/src/x11vnc/rc.d
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/x11vnc
+
+PID=$(pidof -o %PPID /usr/bin/x11vnc)
+case "$1" in
+ start)
+ stat_busy "Starting x11vnc"
+ [[ -z "$PID" ]] && /usr/bin/x11vnc $X11VNC_ARGS &> /dev/null &
+ if [[ $? -gt 0 ]]; then
+ stat_fail
+ else
+ add_daemon x11vnc
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping x11vnc"
+ [[ ! -z "$PID" ]] && kill $PID &> /dev/null
+ if [[ $? -gt 0 ]]; then
+ stat_fail
+ else
+ rm_daemon x11vnc
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/xinetd/xinetd b/src/xinetd/xinetd
new file mode 100755
index 0000000..4b8fa36
--- /dev/null
+++ b/src/xinetd/xinetd
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/sbin/xinetd`
+case "$1" in
+ start)
+ stat_busy "Starting xinetd"
+ [ -z "$PID" ] && /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ echo $PID > /var/run/xinetd.pid
+ add_daemon xinetd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping xinetd"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /var/run/xinetd.pid
+ rm_daemon xinetd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/xl2tpd/xl2tpd.rc b/src/xl2tpd/xl2tpd.rc
new file mode 100755
index 0000000..a06e0d4
--- /dev/null
+++ b/src/xl2tpd/xl2tpd.rc
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ [ -d /var/run/xl2tpd ] || mkdir -p /var/run/xl2tpd
+ stat_busy "Starting xl2tpd"
+ /usr/sbin/xl2tpd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon xl2tpd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping xl2tpd"
+ [ -f /var/run/xl2tpd.pid ] && kill `cat /var/run/xl2tpd.pid`
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /var/run/xl2tpd.pid
+ rm_daemon xl2tpd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/src/xmms2/xmms2d.rc b/src/xmms2/xmms2d.rc
new file mode 100755
index 0000000..5387448
--- /dev/null
+++ b/src/xmms2/xmms2d.rc
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/conf.d/xmms2d.conf
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof xmms2d xmms2-et`
+case "$1" in
+ start)
+ stat_busy "Starting xmms2d"
+ [ -z "$PID" ] && su -c "/usr/bin/xmms2-launcher $XMMS2_PARAMETERS 1>/dev/null 2>/dev/null" - $XMMS2_USER
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon xmms2d
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping xmms2d"
+ [ ! -z "$PID" ] && su -c '/usr/bin/xmms2 quit &>/dev/null' - $XMMS2_USER
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ for i in `seq 1 10`; do
+ [ -d /proc/$PID ] || { stat_done; rm_daemon xmms2d; exit 0; }
+ sleep 1
+ done
+ stat_fail
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/xsp/xsp.rc.d b/src/xsp/xsp.rc.d
new file mode 100755
index 0000000..b4fcda1
--- /dev/null
+++ b/src/xsp/xsp.rc.d
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+# source application-specific settings
+[ -f /etc/conf.d/xsp ] && . /etc/conf.d/xsp
+
+PID=`pidof -o %PPID /usr/bin/mono`
+case "$1" in
+ start)
+ stat_busy "Starting Xsp Daemon"
+ if [ -z "$PID" ]; then
+ /usr/bin/xsp $XSP_PARAMS --nonstop &> /dev/null &
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon xsp
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Xsp Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon xsp
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/yahoo-t/yahoo.rc b/src/yahoo-t/yahoo.rc
new file mode 100755
index 0000000..d047deb
--- /dev/null
+++ b/src/yahoo-t/yahoo.rc
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+get_pid() {
+ echo `ps fax|egrep "python2 ./yahoo.py" | grep -v grep | awk -- "{print \\\$1}"`
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting jabber Yahoo! transport daemon"
+
+ [ -f /var/run/yahoot.pid ] && rm -f /var/run/yahoot.pid
+ PID=`get_pid`
+ if [ -z "$PID" ]; then
+ cd /usr/lib/yahoo-t && exec python2 ./yahoo.py >>/var/log/ejabberd/yahoo1.log 2>>/var/log/ejabberd/yahoo2.log &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ add_daemon yahoo-t
+ stat_done
+ fi
+ else
+ stat_fail
+ exit 1
+ fi
+ ;;
+
+ stop)
+ stat_busy "Stopping jabber Yahoo! transport daemon"
+ PID=`get_pid`
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ exit 1
+ else
+ rm -f /var/run/yahoot.pid &> /dev/null
+ rm_daemon yahoo-t
+ stat_done
+ fi
+ ;;
+
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/src/ypbind-mt/ypbind b/src/ypbind-mt/ypbind
new file mode 100755
index 0000000..6a5ef11
--- /dev/null
+++ b/src/ypbind-mt/ypbind
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+. /etc/conf.d/ypbind
+. /etc/conf.d/nisdomainname
+
+name=ypbind
+PID=$(pidof -o %PPID /usr/sbin/ypbind)
+
+case "$1" in
+start)
+ stat_busy "Starting $name daemon"
+ [[ -n $NISDOMAINNAME ]] && /usr/bin/domainname "$NISDOMAINNAME" &>/dev/null
+ [[ -z "$PID" ]] && /usr/sbin/ypbind $YPBIND_ARGS &>/dev/null \
+ && { add_daemon $name; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+stop)
+ stat_busy "Stopping $name daemon"
+ [[ -n "$PID" ]] && kill $PID &>/dev/null \
+ && { rm_daemon $name; stat_done; } \
+ || { stat_fail; exit 1; }
+ ;;
+restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+*)
+ echo "usage: $0 {start|stop|restart}"
+ exit 1
+ ;;
+esac
diff --git a/src/ypserv/yppasswd b/src/ypserv/yppasswd
new file mode 100755
index 0000000..c2b00b2
--- /dev/null
+++ b/src/ypserv/yppasswd
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting NIS Password Daemon"
+ /usr/sbin/rpc.yppasswdd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon yppasswd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping NIS Password Daemon"
+ killall -q /usr/sbin/rpc.yppasswdd
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon yppasswd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/src/ypserv/ypserv b/src/ypserv/ypserv
new file mode 100755
index 0000000..c36e690
--- /dev/null
+++ b/src/ypserv/ypserv
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting NIS Server"
+ /usr/sbin/ypserv
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ypserv
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping NIS Server"
+ killall -q /usr/sbin/ypserv
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ypserv
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac