It looks like dovecot just lost its rc.d script with today's upgrade to 2.1.15-1 ... here's the old script:
$this->bbcode_second_pass_code('', '
#!/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')
Edit (2/14): Now openvpn has lost its rc.d scripts, so here are the old scripts.
/etc/rc.d/openvpn
$this->bbcode_second_pass_code('', '
#!/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')
/etc/rc.d/openvpn-tapdev
$this->bbcode_second_pass_code('', '
#!/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')
/etc/conf.d/openvpn-tapdev
$this->bbcode_second_pass_code('', '
#
# /etc/conf.d/openvpn-tapdev
#
# Place openvpn-tapdev before network into your DAEMONS array
# This will create permanent tap devices which you can use for bridging
#
# Example:
# TAPDEVS="work home"
# Will create two tap devices "work" and "home"
#
TAPDEVS=""')
Edit (2/22): Now git-daemon has lost its rc.d scripts, so here are the old scripts.
/etc/rc.d/git-daemon
$this->bbcode_second_pass_code('', '
#!/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')
/etc/conf.d/git-daemon.conf
$this->bbcode_second_pass_code('', '
# path to git repositories served
GIT_REPO="/srv/git/"
# see `man git-daemon` for all available options
# $GIT_REPO will be present twice in most configs
GIT_DAEMON_ARGS="--detach --syslog --verbose --base-path=$GIT_REPO $GIT_REPO"')
Edit (2/27): For what it's worth, another file that went missing is /etc/conf.d/samba
$this->bbcode_second_pass_code('', '#
# Configuration for the samba init script
#
# space separated list of daemons to launch
SAMBA_DAEMONS=(smbd nmbd)
#SAMBA_DAEMONS=(smbd nmbd winbindd)')
Edit (3/8): Now syslog-ng has lost its rc.d scripts, so here are the old scripts.
/etc/rc.d/syslog-ng
$this->bbcode_second_pass_code('', '
#!/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/bin/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')
/etc/conf.d/syslog-ng
$this->bbcode_second_pass_code('', '
#
# /etc/conf.d/syslog-ng
#
# passed to syslog-ng on config check
SYSLOG_NG_CHECKOPTS=()
# passed to syslog-ng at startup
SYSLOG_NG_OPTS=()')
Edit (3/20): Now cups has lost its rc.d script, so here it is.
/etc/rc.d/cupsd
$this->bbcode_second_pass_code('', '
#!/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')
Edit (3/27): Now lighttpd has lost its rc.d script, so here it is.
/etc/rc.d/lighttpd
$this->bbcode_second_pass_code('', '
#!/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/bin/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/bin/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/bin/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')
Edit (4/15): Now snmpd has lost its rc.d scripts, so here are the old scripts.
/etc/rc.d/snmpd
$this->bbcode_second_pass_code('', '
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/snmpd
PID=`pidof -o %PPID /usr/bin/snmpd`
case "$1" in
start)
stat_busy "Starting Net-SNMP"
[ -z "$PID" ] && /usr/bin/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')
/etc/conf.d/snmpd
$this->bbcode_second_pass_code('', '
#
# Parameters to be passed to snmpd
#
SNMPD_ARGS=""')
Edit (4/16): Now gpm has lost its rc.d scripts, so here are the old scripts.
/etc/rc.d/gpm
$this->bbcode_second_pass_code('', '
#!/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/bin/gpm)
case "$1" in
start)
stat_busy "Starting GPM Daemon"
[ -z "$PID" ] && /usr/bin/gpm ${GPM_ARGS}
PID=$(pidof -o %PPID /usr/bin/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')
/etc/conf.d/gpm
$this->bbcode_second_pass_code('', '
#
# Parameters to be passed to gpm
#
GPM_ARGS="-m /dev/input/mice -t imps2"')
Edit (5/8): Now nfs has lost its rc.d scripts, so here are the old scripts.
/etc/rc.d/nfs-common
$this->bbcode_second_pass_code('', '
#!/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')
/etc/rc.d/nfs-server
$this->bbcode_second_pass_code('', '
#!/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')
Edit (5/13): Now ddclient has lost its rc.d scripts, so here are the old scripts.
/etc/rc.d/ddclient
$this->bbcode_second_pass_code('', '
#!/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')
/etc/conf.d/ddclient
$this->bbcode_second_pass_code('', '
# Parameters passed to ddclient
EXTRA_ARGS="-daemon 300"')
Edit (5/13): Now exim has lost its rc.d scripts, so here are the old scripts.
/etc/rc.d/exim
$this->bbcode_second_pass_code('', '
#!/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/bin/exim`
case "$1" in
start)
stat_busy "Starting Exim"
[ -z "$PID" ] && /usr/bin/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')
/etc/conf.d/exim
$this->bbcode_second_pass_code('', '
EXIM_ARGS="-bd -q15m"')
Edit (5/13): Now named has lost its rc.d scripts, so here are the old scripts.
/etc/rc.d/named
$this->bbcode_second_pass_code('', '
#!/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/bin/named' || { PID=; rm $PIDFILE 2>/dev/null; }
case "$1" in
start)
stat_busy "Starting BIND"
[ -z "$PID" ] && /usr/bin/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')
/etc/conf.d/named
$this->bbcode_second_pass_code('', '
#
# Parameters to be passed to BIND
#
NAMED_ARGS="-u named"')
Edit (5/13): Now rsyncd has lost its rc.d script, so here is the old script.
/etc/rc.d/rsyncd
$this->bbcode_second_pass_code('', '
#!/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')
Edit (5/15): Now distccd has lost its rc.d script, so here is the old script.
/etc/rc.d/distccd
$this->bbcode_second_pass_code('', '
#!/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')
Edit (5/15): Now motion has lost its rc.d script, so here is the old script.
/etc/rc.d/motion
$this->bbcode_second_pass_code('', '
#!/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')
Edit (5/15): Now prosody has lost its rc.d script, so here is the old script.
/etc/rc.d/prosody
$this->bbcode_second_pass_code('', '
#!/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')
Edit (5/15): Now dante has lost its rc.d script, so here is the old script.
/etc/rc.d/sockd
$this->bbcode_second_pass_code('', '
#!/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')
Edit (5/15): Now tor has lost its rc.d scripts, so here are the old scripts.
/etc/rc.d/tor
$this->bbcode_second_pass_code('', '
#!/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')
/etc/conf.d/tor
$this->bbcode_second_pass_code('', '
# Location of the config file.
TOR_CONF='/etc/tor/torrc'
# Custom ulimit for maximum number of open files.
TOR_MAX_FD=
# Additional arguments.
TOR_ARGS="--quiet"
')
Edit (5/17): Now ftpd has lost its rc.d scripts, so here are the old scripts.
/etc/rc.d/ftpd
$this->bbcode_second_pass_code('', '
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/ftpd
PID=$(pidof -o %PPID /usr/bin/ftpd)
case "$1" in
start)
stat_busy "Starting ftpd"
[ -z "$PID" ] && /usr/bin/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')
/etc/conf.d/ftpd
$this->bbcode_second_pass_code('', '
#
# Parameters to be passed to ftpd
#
FTPD_ARGS=""')
Also, MySQL has been mentioned
here, warning that you shouldn't upgrade it to anything newer than 5.5.24-1 as newer versions are incompatible with this old kernel, and providing a link to version 5.5.24-1.
sethjvm, from your signature, I see you would like to install openvpn, a proxy server, nfs and lvm. I have found that OpenVPN works fine, privoxy works well with Tor, NFSv4 works ok, and LVM works if you load the "dm_mod" module.