hilfe mein git ist komisch
This commit is contained in:
71
etc/init.d/apache-htcacheclean
Executable file
71
etc/init.d/apache-htcacheclean
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/bin/sh
|
||||
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
|
||||
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
|
||||
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
|
||||
fi
|
||||
### BEGIN INIT INFO
|
||||
# Provides: apache-htcacheclean
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Cache cleaner process for Apache2 web server
|
||||
# Description: Start the htcacheclean helper
|
||||
# This script will start htcacheclean which will periodically scan the
|
||||
# cache directory of Apache2's mod_cache_disk and remove outdated files.
|
||||
### END INIT INFO
|
||||
|
||||
DESC="Apache htcacheclean"
|
||||
DAEMON=/usr/bin/htcacheclean
|
||||
|
||||
NAME="${0##*/}"
|
||||
NAME="${NAME##[KS][0-9][0-9]}"
|
||||
DIR_SUFFIX="${NAME##apache-htcacheclean}"
|
||||
APACHE_CONFDIR="${APACHE_CONFDIR:=/etc/apache2$DIR_SUFFIX}"
|
||||
RUN_USER=$(. $APACHE_CONFDIR/envvars > /dev/null && echo "$APACHE_RUN_USER")
|
||||
|
||||
# Default values. Edit /etc/default/apache-htcacheclean$DIR_SUFFIX to change these
|
||||
HTCACHECLEAN_SIZE="${HTCACHECLEAN_SIZE:=300M}"
|
||||
HTCACHECLEAN_DAEMON_INTERVAL="${HTCACHECLEAN_DAEMON_INTERVAL:=120}"
|
||||
HTCACHECLEAN_PATH="${HTCACHECLEAN_PATH:=/var/cache/apache2$DIR_SUFFIX/mod_cache_disk}"
|
||||
HTCACHECLEAN_OPTIONS="${HTCACHECLEAN_OPTIONS:=-n}"
|
||||
|
||||
# Read configuration variable file if it is present
|
||||
if [ -f /etc/default/apache-htcacheclean$DIR_SUFFIX ] ; then
|
||||
. /etc/default/apache-htcacheclean$DIR_SUFFIX
|
||||
elif [ -f /etc/default/apache-htcacheclean ] ; then
|
||||
. /etc/default/apache-htcacheclean
|
||||
fi
|
||||
|
||||
PIDDIR="/var/run/apache2/$RUN_USER"
|
||||
PIDFILE="$PIDDIR/$NAME.pid"
|
||||
DAEMON_ARGS="$HTCACHECLEAN_OPTIONS \
|
||||
-d$HTCACHECLEAN_DAEMON_INTERVAL \
|
||||
-P$PIDFILE -i \
|
||||
-p$HTCACHECLEAN_PATH \
|
||||
-l$HTCACHECLEAN_SIZE"
|
||||
|
||||
do_start_prepare () {
|
||||
if [ ! -d "$PIDDIR" ] ; then
|
||||
mkdir -p "$PIDDIR"
|
||||
chown "$RUN_USER:" "$PIDDIR"
|
||||
fi
|
||||
if [ ! -d "$HTCACHECLEAN_PATH" ] ; then
|
||||
echo "Directory $HTCACHECLEAN_PATH does not exist!" >&2
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
do_start_cmd_override () {
|
||||
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
|
||||
-u $RUN_USER --startas $DAEMON --name htcacheclean --test > /dev/null \
|
||||
|| return 1
|
||||
start-stop-daemon --start --quiet --pidfile ${PIDFILE} \
|
||||
-c $RUN_USER --startas $DAEMON --name htcacheclean -- $DAEMON_ARGS \
|
||||
|| return 2
|
||||
}
|
||||
|
||||
do_stop_cmd_override () {
|
||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
|
||||
-u $RUN_USER --pidfile ${PIDFILE} --name htcacheclean
|
||||
}
|
||||
353
etc/init.d/apache2
Executable file
353
etc/init.d/apache2
Executable file
@@ -0,0 +1,353 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: apache2
|
||||
# Required-Start: $local_fs $remote_fs $network $syslog $named
|
||||
# Required-Stop: $local_fs $remote_fs $network $syslog $named
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# X-Interactive: true
|
||||
# Short-Description: Apache2 web server
|
||||
# Description: Start the web server
|
||||
# This script will start the apache2 web server.
|
||||
### END INIT INFO
|
||||
|
||||
DESC="Apache httpd web server"
|
||||
NAME=apache2
|
||||
DAEMON=/usr/sbin/$NAME
|
||||
|
||||
SCRIPTNAME="${0##*/}"
|
||||
SCRIPTNAME="${SCRIPTNAME##[KS][0-9][0-9]}"
|
||||
if [ -n "$APACHE_CONFDIR" ] ; then
|
||||
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
|
||||
DIR_SUFFIX="${APACHE_CONFDIR##/etc/apache2-}"
|
||||
else
|
||||
DIR_SUFFIX=
|
||||
fi
|
||||
elif [ "${SCRIPTNAME##apache2-}" != "$SCRIPTNAME" ] ; then
|
||||
DIR_SUFFIX="-${SCRIPTNAME##apache2-}"
|
||||
APACHE_CONFDIR=/etc/apache2$DIR_SUFFIX
|
||||
else
|
||||
DIR_SUFFIX=
|
||||
APACHE_CONFDIR=/etc/apache2
|
||||
fi
|
||||
if [ -z "$APACHE_ENVVARS" ] ; then
|
||||
APACHE_ENVVARS=$APACHE_CONFDIR/envvars
|
||||
fi
|
||||
export APACHE_CONFDIR APACHE_ENVVARS
|
||||
|
||||
ENV="env -i LANG=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
if [ "$APACHE_CONFDIR" != /etc/apache2 ] ; then
|
||||
ENV="$ENV APACHE_CONFDIR=$APACHE_CONFDIR"
|
||||
fi
|
||||
if [ "$APACHE_ENVVARS" != "$APACHE_CONFDIR/envvars" ] ; then
|
||||
ENV="$ENV APACHE_ENVVARS=$APACHE_ENVVARS"
|
||||
fi
|
||||
|
||||
PIDFILE=$(. $APACHE_ENVVARS && echo $APACHE_PID_FILE)
|
||||
|
||||
VERBOSE=no
|
||||
if [ -f /etc/default/rcS ]; then
|
||||
. /etc/default/rcS
|
||||
fi
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
|
||||
# Now, set defaults:
|
||||
APACHE2CTL="$ENV apache2ctl"
|
||||
PIDFILE=$(. $APACHE_ENVVARS && echo $APACHE_PID_FILE)
|
||||
APACHE2_INIT_MESSAGE=""
|
||||
|
||||
CONFTEST_OUTFILE=
|
||||
cleanup() {
|
||||
if [ -n "$CONFTEST_OUTFILE" ] ; then
|
||||
rm -f "$CONFTEST_OUTFILE"
|
||||
fi
|
||||
}
|
||||
trap cleanup 0 # "0" means "EXIT", but "EXIT" is not portable
|
||||
|
||||
|
||||
apache_conftest() {
|
||||
[ -z "$CONFTEST_OUTFILE" ] || rm -f "$CONFTEST_OUTFILE"
|
||||
CONFTEST_OUTFILE=$(mktemp)
|
||||
if ! $APACHE2CTL configtest > "$CONFTEST_OUTFILE" 2>&1 ; then
|
||||
return 1
|
||||
else
|
||||
rm -f "$CONFTEST_OUTFILE"
|
||||
CONFTEST_OUTFILE=
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
clear_error_msg() {
|
||||
[ -z "$CONFTEST_OUTFILE" ] || rm -f "$CONFTEST_OUTFILE"
|
||||
CONFTEST_OUTFILE=
|
||||
APACHE2_INIT_MESSAGE=
|
||||
}
|
||||
|
||||
print_error_msg() {
|
||||
[ -z "$APACHE2_INIT_MESSAGE" ] || log_warning_msg "$APACHE2_INIT_MESSAGE"
|
||||
if [ -n "$CONFTEST_OUTFILE" ] ; then
|
||||
echo "Output of config test was:" >&2
|
||||
cat "$CONFTEST_OUTFILE" >&2
|
||||
rm -f "$CONFTEST_OUTFILE"
|
||||
CONFTEST_OUTFILE=
|
||||
fi
|
||||
}
|
||||
|
||||
apache_wait_start() {
|
||||
local STATUS=$1
|
||||
local i=0
|
||||
|
||||
if [ $STATUS != 0 ] ; then
|
||||
return $STATUS
|
||||
fi
|
||||
while : ; do
|
||||
PIDTMP=$(pidofproc -p $PIDFILE $DAEMON)
|
||||
if [ -n "${PIDTMP:-}" ] && kill -0 "${PIDTMP:-}" 2> /dev/null; then
|
||||
return $STATUS
|
||||
fi
|
||||
|
||||
if [ $i = "20" ] ; then
|
||||
APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX instance did not start within 20 seconds. Please read the log files to discover problems"
|
||||
return 2
|
||||
fi
|
||||
|
||||
[ "$VERBOSE" != no ] && log_progress_msg "."
|
||||
sleep 1
|
||||
i=$(($i+1))
|
||||
done
|
||||
}
|
||||
|
||||
apache_wait_stop() {
|
||||
local STATUS=$1
|
||||
local METH=$2
|
||||
|
||||
if [ $STATUS != 0 ] ; then
|
||||
return $STATUS
|
||||
fi
|
||||
|
||||
PIDTMP=$(pidofproc -p $PIDFILE $DAEMON)
|
||||
if [ -n "${PIDTMP:-}" ] && kill -0 "${PIDTMP:-}" 2> /dev/null; then
|
||||
if [ "$METH" = "kill" ]; then
|
||||
killproc -p $PIDFILE $DAEMON
|
||||
else
|
||||
$APACHE2CTL $METH > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
local i=0
|
||||
while kill -0 "${PIDTMP:-}" 2> /dev/null; do
|
||||
if [ $i = '60' ]; then
|
||||
STATUS=2
|
||||
break
|
||||
fi
|
||||
[ "$VERBOSE" != no ] && log_progress_msg "."
|
||||
sleep 1
|
||||
i=$(($i+1))
|
||||
done
|
||||
return $STATUS
|
||||
else
|
||||
return $STATUS
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Function that starts the daemon/service
|
||||
#
|
||||
do_start()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been started
|
||||
# 1 if daemon was already running
|
||||
# 2 if daemon could not be started
|
||||
|
||||
if pidofproc -p $PIDFILE "$DAEMON" > /dev/null 2>&1 ; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if apache_conftest ; then
|
||||
$APACHE2CTL start
|
||||
apache_wait_start $?
|
||||
return $?
|
||||
else
|
||||
APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed."
|
||||
return 2
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service
|
||||
#
|
||||
do_stop()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been stopped
|
||||
# 1 if daemon was already stopped
|
||||
# 2 if daemon could not be stopped
|
||||
# other if a failure occurred
|
||||
|
||||
# either "stop" or "graceful-stop"
|
||||
local STOP=$1
|
||||
# can't use pidofproc from LSB here
|
||||
local AP_RET=0
|
||||
|
||||
if pidof $DAEMON > /dev/null 2>&1 ; then
|
||||
if [ -e $PIDFILE ] && pidof $DAEMON | tr ' ' '\n' | grep -w $(cat $PIDFILE) > /dev/null 2>&1 ; then
|
||||
AP_RET=2
|
||||
else
|
||||
AP_RET=1
|
||||
fi
|
||||
else
|
||||
AP_RET=0
|
||||
fi
|
||||
|
||||
# AP_RET is:
|
||||
# 0 if Apache (whichever) is not running
|
||||
# 1 if Apache (whichever) is running
|
||||
# 2 if Apache from the PIDFILE is running
|
||||
|
||||
if [ $AP_RET = 0 ] ; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $AP_RET = 2 ] && apache_conftest ; then
|
||||
apache_wait_stop $? $STOP
|
||||
return $?
|
||||
else
|
||||
if [ $AP_RET = 2 ]; then
|
||||
clear_error_msg
|
||||
APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed, so we are trying to kill it manually. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!"
|
||||
apache_wait_stop $? "kill"
|
||||
return $?
|
||||
elif [ $AP_RET = 1 ] ; then
|
||||
APACHE2_INIT_MESSAGE="There are processes named 'apache2' running which do not match your pid file which are left untouched in the name of safety, Please review the situation by hand".
|
||||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Function that sends a SIGHUP to the daemon/service
|
||||
#
|
||||
do_reload() {
|
||||
if apache_conftest; then
|
||||
if ! pidofproc -p $PIDFILE "$DAEMON" > /dev/null 2>&1 ; then
|
||||
APACHE2_INIT_MESSAGE="Apache2 is not running"
|
||||
return 2
|
||||
fi
|
||||
$APACHE2CTL graceful > /dev/null 2>&1
|
||||
return $?
|
||||
else
|
||||
APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed. Not doing anything."
|
||||
return 2
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Sanity checks. They need to occur after function declarations
|
||||
[ -x $DAEMON ] || exit 0
|
||||
|
||||
if [ ! -x $DAEMON ] ; then
|
||||
echo "No apache-bin package installed"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "$PIDFILE" ] ; then
|
||||
echo ERROR: APACHE_PID_FILE needs to be defined in $APACHE_ENVVARS >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_daemon_msg "Starting $DESC" "$NAME"
|
||||
do_start
|
||||
RET_STATUS=$?
|
||||
case "$RET_STATUS" in
|
||||
0|1)
|
||||
log_success_msg
|
||||
[ "$VERBOSE" != no ] && [ $RET_STATUS = 1 ] && log_warning_msg "Server was already running"
|
||||
;;
|
||||
2)
|
||||
log_failure_msg
|
||||
print_error_msg
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
stop|graceful-stop)
|
||||
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
do_stop "$1"
|
||||
RET_STATUS=$?
|
||||
case "$RET_STATUS" in
|
||||
0|1)
|
||||
log_success_msg
|
||||
[ "$VERBOSE" != no ] && [ $RET_STATUS = 1 ] && log_warning_msg "Server was not running"
|
||||
;;
|
||||
2)
|
||||
log_failure_msg
|
||||
print_error_msg
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
print_error_msg
|
||||
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p $PIDFILE "apache2" "$NAME"
|
||||
exit $?
|
||||
;;
|
||||
reload|force-reload|graceful)
|
||||
log_daemon_msg "Reloading $DESC" "$NAME"
|
||||
do_reload
|
||||
RET_STATUS=$?
|
||||
case "$RET_STATUS" in
|
||||
0|1)
|
||||
log_success_msg
|
||||
[ "$VERBOSE" != no ] && [ $RET_STATUS = 1 ] && log_warning_msg "Server was already running"
|
||||
;;
|
||||
2)
|
||||
log_failure_msg
|
||||
print_error_msg
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
print_error_msg
|
||||
;;
|
||||
restart)
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_stop stop
|
||||
case "$?" in
|
||||
0|1)
|
||||
do_start
|
||||
case "$?" in
|
||||
0)
|
||||
log_end_msg 0
|
||||
;;
|
||||
1|*)
|
||||
log_end_msg 1 # Old process is still or failed to running
|
||||
print_error_msg
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
# Failed to stop
|
||||
log_end_msg 1
|
||||
print_error_msg
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
start-htcacheclean|stop-htcacheclean)
|
||||
echo "Use 'service apache-htcacheclean' instead"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|graceful-stop|restart|reload|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
156
etc/init.d/apparmor
Executable file
156
etc/init.d/apparmor
Executable file
@@ -0,0 +1,156 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------
|
||||
# Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||
# NOVELL (All rights reserved)
|
||||
# Copyright (c) 2008, 2009 Canonical, Ltd.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of version 2 of the GNU General Public
|
||||
# License published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, contact Novell, Inc.
|
||||
# ----------------------------------------------------------------------
|
||||
# Authors:
|
||||
# Steve Beattie <steve.beattie@canonical.com>
|
||||
# Kees Cook <kees@ubuntu.com>
|
||||
#
|
||||
# /etc/init.d/apparmor
|
||||
#
|
||||
# Note: "Required-Start: $local_fs" implies that the cache may not be available
|
||||
# yet when /var is on a remote filesystem. The worst consequence this should
|
||||
# have is slowing down the boot.
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: apparmor
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop: umountfs
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: AppArmor initialization
|
||||
# Description: AppArmor init script. This script loads all AppArmor profiles.
|
||||
### END INIT INFO
|
||||
|
||||
APPARMOR_FUNCTIONS=/lib/apparmor/rc.apparmor.functions
|
||||
|
||||
# Functions needed by rc.apparmor.functions
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
aa_action() {
|
||||
STRING=$1
|
||||
shift
|
||||
$*
|
||||
rc=$?
|
||||
if [ $rc -eq 0 ] ; then
|
||||
aa_log_success_msg $"$STRING "
|
||||
else
|
||||
aa_log_failure_msg $"$STRING "
|
||||
fi
|
||||
return $rc
|
||||
}
|
||||
|
||||
aa_log_action_start() {
|
||||
log_action_begin_msg $@
|
||||
}
|
||||
|
||||
aa_log_action_end() {
|
||||
log_action_end_msg $@
|
||||
}
|
||||
|
||||
aa_log_success_msg() {
|
||||
log_success_msg $@
|
||||
}
|
||||
|
||||
aa_log_warning_msg() {
|
||||
log_warning_msg $@
|
||||
}
|
||||
|
||||
aa_log_failure_msg() {
|
||||
log_failure_msg $@
|
||||
}
|
||||
|
||||
aa_log_skipped_msg() {
|
||||
if [ -n "$1" ]; then
|
||||
log_warning_msg "${1}: Skipped."
|
||||
fi
|
||||
}
|
||||
|
||||
aa_log_daemon_msg() {
|
||||
log_daemon_msg $@
|
||||
}
|
||||
|
||||
aa_log_end_msg() {
|
||||
log_end_msg $@
|
||||
}
|
||||
|
||||
# Source AppArmor function library
|
||||
if [ -f "${APPARMOR_FUNCTIONS}" ]; then
|
||||
. ${APPARMOR_FUNCTIONS}
|
||||
else
|
||||
aa_log_failure_msg "Unable to find AppArmor initscript functions"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 {start|stop|restart|reload|force-reload|status}"
|
||||
}
|
||||
|
||||
test -x ${PARSER} || exit 0 # by debian policy
|
||||
# LSM is built-in, so it is either there or not enabled for this boot
|
||||
test -d /sys/module/apparmor || exit 0
|
||||
|
||||
# do not perform start/stop/reload actions when running from liveCD
|
||||
test -d /rofs/etc/apparmor.d && exit 0
|
||||
|
||||
rc=255
|
||||
case "$1" in
|
||||
start)
|
||||
if [ -x /usr/bin/systemd-detect-virt ] && \
|
||||
systemd-detect-virt --quiet --container && \
|
||||
! is_container_with_internal_policy; then
|
||||
aa_log_daemon_msg "Not starting AppArmor in container"
|
||||
aa_log_end_msg 0
|
||||
exit 0
|
||||
fi
|
||||
apparmor_start
|
||||
rc=$?
|
||||
;;
|
||||
restart|reload|force-reload)
|
||||
if [ -x /usr/bin/systemd-detect-virt ] && \
|
||||
systemd-detect-virt --quiet --container && \
|
||||
! is_container_with_internal_policy; then
|
||||
aa_log_daemon_msg "Not starting AppArmor in container"
|
||||
aa_log_end_msg 0
|
||||
exit 0
|
||||
fi
|
||||
apparmor_restart
|
||||
rc=$?
|
||||
;;
|
||||
stop)
|
||||
aa_log_daemon_msg "Leaving AppArmor profiles loaded"
|
||||
cat >&2 <<EOM
|
||||
No profiles have been unloaded.
|
||||
|
||||
Unloading profiles will leave already running processes permanently
|
||||
unconfined, which can lead to unexpected situations.
|
||||
|
||||
To set a process to complain mode, use the command line tool
|
||||
'aa-complain'. To really tear down all profiles, run 'aa-teardown'."
|
||||
EOM
|
||||
;;
|
||||
status)
|
||||
apparmor_status
|
||||
rc=$?
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
rc=1
|
||||
;;
|
||||
esac
|
||||
exit $rc
|
||||
102
etc/init.d/apport
Executable file
102
etc/init.d/apport
Executable file
@@ -0,0 +1,102 @@
|
||||
#! /bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: apport
|
||||
# Required-Start: $local_fs $remote_fs
|
||||
# Required-Stop: $local_fs $remote_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop:
|
||||
# Short-Description: automatic crash report generation
|
||||
### END INIT INFO
|
||||
|
||||
DESC="automatic crash report generation"
|
||||
NAME=apport
|
||||
AGENT=/usr/share/apport/apport
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x "$AGENT" ] || exit 0
|
||||
|
||||
# read default file
|
||||
enabled=1
|
||||
[ -e /etc/default/$NAME ] && . /etc/default/$NAME || true
|
||||
|
||||
# Define LSB log_* functions.
|
||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
#
|
||||
# Function that starts the daemon/service
|
||||
#
|
||||
do_start()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been started
|
||||
# 1 if daemon was already running
|
||||
# 2 if daemon could not be started
|
||||
|
||||
$AGENT --start
|
||||
|
||||
# check for incomplete suspend/resume or hibernate
|
||||
if [ -e /var/lib/pm-utils/status ]; then
|
||||
/usr/share/apport/apportcheckresume || true
|
||||
rm -f /var/lib/pm-utils/status
|
||||
rm -f /var/lib/pm-utils/resume-hang.log
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service
|
||||
#
|
||||
do_stop()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been stopped
|
||||
# 1 if daemon was already stopped
|
||||
# 2 if daemon could not be stopped
|
||||
# other if a failure occurred
|
||||
|
||||
# Check for a hung resume. If we find one try and grab everything
|
||||
# we can to aid in its discovery.
|
||||
if [ -e /var/lib/pm-utils/status ]; then
|
||||
ps -wwef >/var/lib/pm-utils/resume-hang.log
|
||||
fi
|
||||
|
||||
$AGENT --stop
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
# don't start in containers
|
||||
grep -zqs '^container=' /proc/1/environ && exit 0
|
||||
|
||||
[ "$enabled" = "1" ] || [ "$force_start" = "1" ] || exit 0
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC:" "$NAME"
|
||||
do_start
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
# don't stop in containers
|
||||
grep -zqs '^container=' /proc/1/environ && exit 0
|
||||
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC:" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
restart|force-reload)
|
||||
$0 stop || true
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
:
|
||||
46
etc/init.d/console-setup.sh
Executable file
46
etc/init.d/console-setup.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: console-setup.sh
|
||||
# Required-Start: $remote_fs
|
||||
# Required-Stop:
|
||||
# Should-Start: console-screen kbd
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop:
|
||||
# X-Interactive: true
|
||||
# Short-Description: Set console font and keymap
|
||||
### END INIT INFO
|
||||
|
||||
if [ -f /bin/setupcon ]; then
|
||||
case "$1" in
|
||||
stop|status)
|
||||
# console-setup isn't a daemon
|
||||
;;
|
||||
start|force-reload|restart|reload)
|
||||
if [ -f /lib/lsb/init-functions ]; then
|
||||
. /lib/lsb/init-functions
|
||||
else
|
||||
log_action_begin_msg () {
|
||||
echo -n "$@... "
|
||||
}
|
||||
|
||||
log_action_end_msg () {
|
||||
if [ "$1" -eq 0 ]; then
|
||||
echo done.
|
||||
else
|
||||
echo failed.
|
||||
fi
|
||||
}
|
||||
fi
|
||||
log_action_begin_msg "Setting up console font and keymap"
|
||||
if /lib/console-setup/console-setup.sh; then
|
||||
log_action_end_msg 0
|
||||
else
|
||||
log_action_end_msg $?
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo 'Usage: /etc/init.d/console-setup.sh {start|reload|restart|force-reload|stop|status}'
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
92
etc/init.d/cron
Executable file
92
etc/init.d/cron
Executable file
@@ -0,0 +1,92 @@
|
||||
#!/bin/sh
|
||||
# Start/stop the cron daemon.
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: cron
|
||||
# Required-Start: $remote_fs $syslog $time
|
||||
# Required-Stop: $remote_fs $syslog $time
|
||||
# Should-Start: $network $named slapd autofs ypbind nscd nslcd winbind sssd
|
||||
# Should-Stop: $network $named slapd autofs ypbind nscd nslcd winbind sssd
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop:
|
||||
# Short-Description: Regular background program processing daemon
|
||||
# Description: cron is a standard UNIX program that runs user-specified
|
||||
# programs at periodic scheduled times. vixie cron adds a
|
||||
# number of features to the basic UNIX cron, including better
|
||||
# security and more powerful configuration options.
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
DESC="cron daemon"
|
||||
NAME=cron
|
||||
DAEMON=/usr/sbin/cron
|
||||
PIDFILE=/var/run/crond.pid
|
||||
SCRIPTNAME=/etc/init.d/"$NAME"
|
||||
|
||||
test -f $DAEMON || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
[ -r /etc/default/cron ] && . /etc/default/cron
|
||||
|
||||
# Read the system's locale and set cron's locale. This is only used for
|
||||
# setting the charset of mails generated by cron. To provide locale
|
||||
# information to tasks running under cron, see /etc/pam.d/cron.
|
||||
#
|
||||
# We read /etc/environment, but warn about locale information in
|
||||
# there because it should be in /etc/default/locale.
|
||||
parse_environment ()
|
||||
{
|
||||
for ENV_FILE in /etc/environment /etc/default/locale; do
|
||||
[ -r "$ENV_FILE" ] || continue
|
||||
[ -s "$ENV_FILE" ] || continue
|
||||
|
||||
for var in LANG LANGUAGE LC_ALL LC_CTYPE; do
|
||||
value=`egrep "^${var}=" "$ENV_FILE" | tail -n1 | cut -d= -f2`
|
||||
[ -n "$value" ] && eval export $var=$value
|
||||
|
||||
if [ -n "$value" ] && [ "$ENV_FILE" = /etc/environment ]; then
|
||||
log_warning_msg "/etc/environment has been deprecated for locale information; use /etc/default/locale for $var=$value instead"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# Get the timezone set.
|
||||
if [ -z "$TZ" -a -e /etc/localtime ]; then
|
||||
TZ=$(readlink /etc/localtime | sed "s|/usr/share/zoneinfo/||")
|
||||
fi
|
||||
}
|
||||
|
||||
# Parse the system's environment
|
||||
if [ "$READ_ENV" = "yes" ] ; then
|
||||
parse_environment
|
||||
fi
|
||||
|
||||
|
||||
case "$1" in
|
||||
start) log_daemon_msg "Starting periodic command scheduler" "cron"
|
||||
start_daemon -p $PIDFILE $DAEMON -P $EXTRA_OPTS
|
||||
log_end_msg $?
|
||||
;;
|
||||
stop) log_daemon_msg "Stopping periodic command scheduler" "cron"
|
||||
killproc -p $PIDFILE $DAEMON
|
||||
RETVAL=$?
|
||||
[ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE
|
||||
log_end_msg $RETVAL
|
||||
;;
|
||||
restart) log_daemon_msg "Restarting periodic command scheduler" "cron"
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
reload|force-reload) log_daemon_msg "Reloading configuration files for periodic command scheduler" "cron"
|
||||
# cron reloads automatically
|
||||
log_end_msg 0
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
|
||||
;;
|
||||
*) log_action_msg "Usage: /etc/init.d/cron {start|stop|status|restart|reload|force-reload}"
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
53
etc/init.d/cryptdisks
Executable file
53
etc/init.d/cryptdisks
Executable file
@@ -0,0 +1,53 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: cryptdisks
|
||||
# Required-Start: checkroot cryptdisks-early
|
||||
# Required-Stop: umountroot cryptdisks-early
|
||||
# Should-Start: udev mdadm-raid lvm2
|
||||
# Should-Stop: udev mdadm-raid lvm2
|
||||
# X-Start-Before: checkfs
|
||||
# X-Stop-After: umountfs
|
||||
# X-Interactive: true
|
||||
# Default-Start: S
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Setup remaining encrypted block devices.
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
if [ -r /lib/cryptsetup/cryptdisks-functions ]; then
|
||||
. /lib/cryptsetup/cryptdisks-functions
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
INITSTATE="remaining"
|
||||
DEFAULT_LOUD="yes"
|
||||
|
||||
case "$CRYPTDISKS_ENABLE" in
|
||||
[Nn]*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
do_start
|
||||
;;
|
||||
stop)
|
||||
do_stop
|
||||
;;
|
||||
restart|reload|force-reload)
|
||||
do_stop
|
||||
do_start
|
||||
;;
|
||||
force-start)
|
||||
FORCE_START="yes"
|
||||
do_start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: cryptdisks {start|stop|restart|reload|force-reload|force-start}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
53
etc/init.d/cryptdisks-early
Executable file
53
etc/init.d/cryptdisks-early
Executable file
@@ -0,0 +1,53 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: cryptdisks-early
|
||||
# Required-Start: checkroot
|
||||
# Required-Stop: umountroot
|
||||
# Should-Start: udev mdadm-raid
|
||||
# Should-Stop: udev mdadm-raid
|
||||
# X-Start-Before: lvm2
|
||||
# X-Stop-After: lvm2 umountfs
|
||||
# X-Interactive: true
|
||||
# Default-Start: S
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Setup early encrypted block devices.
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
if [ -r /lib/cryptsetup/cryptdisks-functions ]; then
|
||||
. /lib/cryptsetup/cryptdisks-functions
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
|
||||
INITSTATE="early"
|
||||
DEFAULT_LOUD=""
|
||||
|
||||
case "$CRYPTDISKS_ENABLE" in
|
||||
[Nn]*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
do_start
|
||||
;;
|
||||
stop)
|
||||
do_stop
|
||||
;;
|
||||
restart|reload|force-reload)
|
||||
do_stop
|
||||
do_start
|
||||
;;
|
||||
force-start)
|
||||
FORCE_START="yes"
|
||||
do_start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: cryptdisks-early {start|stop|restart|reload|force-reload|force-start}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
129
etc/init.d/dbus
Executable file
129
etc/init.d/dbus
Executable file
@@ -0,0 +1,129 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: dbus
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop:
|
||||
# Short-Description: D-Bus systemwide message bus
|
||||
# Description: D-Bus is a simple interprocess messaging system, used
|
||||
# for sending messages between applications.
|
||||
### END INIT INFO
|
||||
# -*- coding: utf-8 -*-
|
||||
# Debian init.d script for D-BUS
|
||||
# Copyright © 2003 Colin Walters <walters@debian.org>
|
||||
# Copyright © 2005 Sjoerd Simons <sjoerd@debian.org>
|
||||
|
||||
set -e
|
||||
|
||||
DAEMON=/usr/bin/dbus-daemon
|
||||
UUIDGEN=/usr/bin/dbus-uuidgen
|
||||
UUIDGEN_OPTS=--ensure
|
||||
NAME=dbus
|
||||
DAEMONUSER=messagebus
|
||||
PIDDIR=/var/run/dbus
|
||||
PIDFILE=$PIDDIR/pid
|
||||
DESC="system message bus"
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# Source defaults file; edit that file to configure this script.
|
||||
PARAMS=""
|
||||
if [ -e /etc/default/dbus ]; then
|
||||
. /etc/default/dbus
|
||||
fi
|
||||
|
||||
create_machineid() {
|
||||
# Create machine-id file
|
||||
if [ -x $UUIDGEN ]; then
|
||||
$UUIDGEN $UUIDGEN_OPTS
|
||||
fi
|
||||
}
|
||||
|
||||
start_it_up()
|
||||
{
|
||||
if [ ! -d $PIDDIR ]; then
|
||||
mkdir -p $PIDDIR
|
||||
chown $DAEMONUSER $PIDDIR
|
||||
chgrp $DAEMONUSER $PIDDIR
|
||||
fi
|
||||
|
||||
if ! mountpoint -q /proc/ ; then
|
||||
log_failure_msg "Can't start $DESC - /proc is not mounted"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -e $PIDFILE ]; then
|
||||
if $0 status > /dev/null ; then
|
||||
log_success_msg "$DESC already started; not starting."
|
||||
return
|
||||
else
|
||||
log_success_msg "Removing stale PID file $PIDFILE."
|
||||
rm -f $PIDFILE
|
||||
fi
|
||||
fi
|
||||
|
||||
create_machineid
|
||||
|
||||
# Force libnss-systemd to avoid trying to communicate via D-Bus, which
|
||||
# is never going to work well from within dbus-daemon. systemd
|
||||
# special-cases this internally, but we might need to do the same when
|
||||
# booting with sysvinit if libnss-systemd is still installed.
|
||||
# (Workaround for #940971)
|
||||
export SYSTEMD_NSS_BYPASS_BUS=1
|
||||
|
||||
log_daemon_msg "Starting $DESC" "$NAME"
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE \
|
||||
--exec $DAEMON -- --system $PARAMS
|
||||
log_end_msg $?
|
||||
}
|
||||
|
||||
shut_it_down()
|
||||
{
|
||||
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
start-stop-daemon --stop --retry 5 --quiet --oknodo --pidfile $PIDFILE \
|
||||
--user $DAEMONUSER
|
||||
# We no longer include these arguments so that start-stop-daemon
|
||||
# can do its job even given that we may have been upgraded.
|
||||
# We rely on the pidfile being sanely managed
|
||||
# --exec $DAEMON -- --system $PARAMS
|
||||
log_end_msg $?
|
||||
rm -f $PIDFILE
|
||||
}
|
||||
|
||||
reload_it()
|
||||
{
|
||||
create_machineid
|
||||
log_action_begin_msg "Reloading $DESC config"
|
||||
dbus-send --print-reply --system --type=method_call \
|
||||
--dest=org.freedesktop.DBus \
|
||||
/ org.freedesktop.DBus.ReloadConfig > /dev/null
|
||||
# hopefully this is enough time for dbus to reload it's config file.
|
||||
log_action_end_msg $?
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start_it_up
|
||||
;;
|
||||
stop)
|
||||
shut_it_down
|
||||
;;
|
||||
reload|force-reload)
|
||||
reload_it
|
||||
;;
|
||||
restart)
|
||||
shut_it_down
|
||||
start_it_up
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|status}" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
118
etc/init.d/docker
Executable file
118
etc/init.d/docker
Executable file
@@ -0,0 +1,118 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: docker
|
||||
# Required-Start: $syslog $remote_fs
|
||||
# Required-Stop: $syslog $remote_fs
|
||||
# Should-Start: cgroupfs-mount cgroup-lite
|
||||
# Should-Stop: cgroupfs-mount cgroup-lite
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Create lightweight, portable, self-sufficient containers.
|
||||
# Description:
|
||||
# Docker is an open-source project to easily create lightweight, portable,
|
||||
# self-sufficient containers from any application. The same container that a
|
||||
# developer builds and tests on a laptop can run at scale, in production, on
|
||||
# VMs, bare metal, OpenStack clusters, public clouds and more.
|
||||
### END INIT INFO
|
||||
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
|
||||
|
||||
BASE=docker
|
||||
|
||||
# modify these in /etc/default/$BASE (/etc/default/docker)
|
||||
DOCKERD=/usr/bin/dockerd
|
||||
# This is the pid file managed by docker itself
|
||||
DOCKER_PIDFILE=/var/run/$BASE.pid
|
||||
# This is the pid file created/managed by start-stop-daemon
|
||||
DOCKER_SSD_PIDFILE=/var/run/$BASE-ssd.pid
|
||||
DOCKER_LOGFILE=/var/log/$BASE.log
|
||||
DOCKER_OPTS=
|
||||
DOCKER_DESC="Docker"
|
||||
|
||||
# Get lsb functions
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
if [ -f /etc/default/$BASE ]; then
|
||||
. /etc/default/$BASE
|
||||
fi
|
||||
|
||||
# Check docker is present
|
||||
if [ ! -x $DOCKERD ]; then
|
||||
log_failure_msg "$DOCKERD not present or not executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fail_unless_root() {
|
||||
if [ "$(id -u)" != '0' ]; then
|
||||
log_failure_msg "$DOCKER_DESC must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
fail_unless_root
|
||||
|
||||
touch "$DOCKER_LOGFILE"
|
||||
chgrp docker "$DOCKER_LOGFILE"
|
||||
|
||||
# Only set the hard limit (soft limit should remain as the system default of 1024):
|
||||
ulimit -Hn 524288
|
||||
|
||||
# Having non-zero limits causes performance problems due to accounting overhead
|
||||
# in the kernel. We recommend using cgroups to do container-local accounting.
|
||||
if [ "$BASH" ]; then
|
||||
ulimit -u unlimited
|
||||
else
|
||||
ulimit -p unlimited
|
||||
fi
|
||||
|
||||
log_begin_msg "Starting $DOCKER_DESC: $BASE"
|
||||
start-stop-daemon --start --background \
|
||||
--no-close \
|
||||
--exec "$DOCKERD" \
|
||||
--pidfile "$DOCKER_SSD_PIDFILE" \
|
||||
--make-pidfile \
|
||||
-- \
|
||||
-p "$DOCKER_PIDFILE" \
|
||||
$DOCKER_OPTS \
|
||||
>> "$DOCKER_LOGFILE" 2>&1
|
||||
log_end_msg $?
|
||||
;;
|
||||
|
||||
stop)
|
||||
fail_unless_root
|
||||
if [ -f "$DOCKER_SSD_PIDFILE" ]; then
|
||||
log_begin_msg "Stopping $DOCKER_DESC: $BASE"
|
||||
start-stop-daemon --stop --pidfile "$DOCKER_SSD_PIDFILE" --retry 10
|
||||
log_end_msg $?
|
||||
else
|
||||
log_warning_msg "Docker already stopped - file $DOCKER_SSD_PIDFILE not found."
|
||||
fi
|
||||
;;
|
||||
|
||||
restart)
|
||||
fail_unless_root
|
||||
docker_pid=$(cat "$DOCKER_SSD_PIDFILE" 2> /dev/null || true)
|
||||
[ -n "$docker_pid" ] \
|
||||
&& ps -p $docker_pid > /dev/null 2>&1 \
|
||||
&& $0 stop
|
||||
$0 start
|
||||
;;
|
||||
|
||||
force-reload)
|
||||
fail_unless_root
|
||||
$0 restart
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc -p "$DOCKER_SSD_PIDFILE" "$DOCKERD" "$DOCKER_DESC"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: service docker {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
197
etc/init.d/drwebd
Executable file
197
etc/init.d/drwebd
Executable file
@@ -0,0 +1,197 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Dr.Web drwebd init script
|
||||
#
|
||||
# $Id: 4f28f79ede3baa352db7e7ab479ae6bf294ace4e $
|
||||
#
|
||||
# chkconfig: 235 20 80
|
||||
# description: drwebd is a Dr.Web Daemon
|
||||
# processname: drwebd
|
||||
# config: /etc/drweb/drweb32.ini
|
||||
# pidfile: /var/drweb/run/drwebd.pid
|
||||
### BEGIN INIT INFO
|
||||
# Provides: drwebd
|
||||
# Required-Start: $local_fs $network
|
||||
# Required-Stop: $null
|
||||
# Should-Start: $null
|
||||
# Should-Stop: $null
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# X-Start-Before: keriomailserver
|
||||
# Description: drwebd is a Dr.Web Daemon
|
||||
### END INIT INFO
|
||||
|
||||
DAEMON=/opt/drweb/drwebd
|
||||
PIDFILE=/var/drweb/run/drwebd.pid
|
||||
TIMEOUT=300
|
||||
|
||||
PATH=/usr/xpg4/bin:/bin:/usr/bin:/usr/ucb:/sbin:/usr/sbin:${PATH}
|
||||
|
||||
EXIT_SUCCESS=0
|
||||
EXIT_FAILURE_NOFILE=1
|
||||
EXIT_FAILURE_RUNNING=2
|
||||
EXIT_FAILURE_NOT_RUNNING=3
|
||||
EXIT_FAILURE_TIMEOUT=4
|
||||
EXIT_FAILURE_NOARGS=5
|
||||
EXIT_FAILURE_NOT_ROOT=6
|
||||
|
||||
STATUS_NOPID=1
|
||||
STATUS_ALIVE=0
|
||||
STATUS_NOT_ALIVE=2
|
||||
STATUS_WRONG_PID=3
|
||||
|
||||
if test -n "$1" -a ! "$1" = "status" ; then
|
||||
case "`id`" in
|
||||
uid=0*)
|
||||
;;
|
||||
*)
|
||||
echo "$0 $1 must be executed with root privileges"
|
||||
exit $EXIT_FAILURE_NOT_ROOT
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
check_run() {
|
||||
runfiles="/etc/drweb/drwebd.enable /etc/default/drwebd /etc/sysconfig/drwebd /etc/drweb/daemons.run"
|
||||
enabled=""
|
||||
found=""
|
||||
for runfile in $runfiles ; do
|
||||
if test -f "$runfile" ; then
|
||||
found=1
|
||||
. "$runfile"
|
||||
if test "$RUN_DRWEBD" = "1" -o "$ENABLE" = "1" ; then
|
||||
enabled=1
|
||||
break
|
||||
else
|
||||
echo "Dr.Web drwebd is disabled according to $runfile"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if test -z "$found" ; then
|
||||
echo "Didn't found a enable file for Dr.Web drwebd. See documentation to solve this problem"
|
||||
exit $EXIT_FAILURE_NOFILE
|
||||
fi
|
||||
test -z "$enabled" && exit $EXIT_SUCCESS
|
||||
}
|
||||
|
||||
get_pid() {
|
||||
head -1 "$PIDFILE" 2>/dev/null
|
||||
}
|
||||
|
||||
check_pid() {
|
||||
if test -r "$PIDFILE" ; then
|
||||
pid=`get_pid`
|
||||
if test -n "$pid" ; then
|
||||
if kill -0 "$pid" 2>/dev/null || ps -p "$pid" >/dev/null 2>&1 ; then
|
||||
return $STATUS_ALIVE
|
||||
else
|
||||
return $STATUS_NOT_ALIVE
|
||||
fi
|
||||
else
|
||||
return $STATUS_WRONG_PID
|
||||
fi
|
||||
else
|
||||
return $STATUS_NOPID
|
||||
fi
|
||||
}
|
||||
|
||||
start_daemon() {
|
||||
if test ! -x "$DAEMON" ; then
|
||||
echo "Dr.Web drwebd is not installed"
|
||||
exit $EXIT_FAILURE_NOFILE
|
||||
fi
|
||||
|
||||
|
||||
|
||||
"$DAEMON" "$@"
|
||||
return $?
|
||||
}
|
||||
|
||||
stop_daemon() {
|
||||
pid=`get_pid`
|
||||
if test -n "$pid" ; then
|
||||
kill "$pid"
|
||||
fi
|
||||
seconds=0
|
||||
retval=0
|
||||
while check_pid ; do
|
||||
sleep 1
|
||||
printf "."
|
||||
seconds=`expr $seconds + 1`
|
||||
if test "$seconds" -gt "$TIMEOUT" ; then
|
||||
retval=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
test "$seconds" -gt "0" && echo
|
||||
return $retval
|
||||
}
|
||||
|
||||
die() {
|
||||
echo "$2" && exit $1
|
||||
}
|
||||
|
||||
die_if_running() {
|
||||
check_pid && die $EXIT_FAILURE_RUNNING "Dr.Web drwebd is already running"
|
||||
}
|
||||
|
||||
die_if_not_running() {
|
||||
check_pid
|
||||
case "$?" in
|
||||
$STATUS_NOPID) die $EXIT_FAILURE_NOT_RUNNING "Dr.Web drwebd is not running" ;;
|
||||
$STATUS_NOT_ALIVE|$STATUS_WRONG_PID) die $EXIT_FAILURE_NOT_RUNNING \
|
||||
"Dr.Web drwebd is not running but $PIDFILE exists" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
die_if_timeout() {
|
||||
die $EXIT_FAILURE_RUNNING "Dr.Web drwebd seems is still running"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
stop)
|
||||
die_if_not_running
|
||||
echo "Shutting down Dr.Web drwebd..."
|
||||
stop_daemon || die_if_timeout
|
||||
;;
|
||||
reload)
|
||||
die_if_not_running
|
||||
echo "Reloading Dr.Web drwebd..."
|
||||
pid=`get_pid`
|
||||
if test -n "$pid" ; then
|
||||
kill -HUP "$pid"
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
echo "Restarting Dr.Web drwebd..."
|
||||
if check_pid ; then
|
||||
stop_daemon || die_if_timeout
|
||||
fi
|
||||
start_daemon
|
||||
;;
|
||||
condrestart)
|
||||
die_if_not_running
|
||||
echo "Restarting Dr.Web drwebd..."
|
||||
stop_daemon || die_if_timeout
|
||||
start_daemon
|
||||
;;
|
||||
start)
|
||||
die_if_running
|
||||
echo "Starting Dr.Web drwebd..."
|
||||
start_daemon
|
||||
;;
|
||||
status)
|
||||
check_pid
|
||||
case "$?" in
|
||||
$STATUS_ALIVE) echo "Dr.Web drwebd is running" ;;
|
||||
$STATUS_NOPID) echo "Dr.Web drwebd is not running" ;;
|
||||
$STATUS_NOT_ALIVE|$STATUS_WRONG_PID) echo "Dr.Web drwebd is not running but $PIDFILE exists" ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|condrestart|reload|status}"
|
||||
exit $EXIT_FAILURE_NOARGS
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $EXIT_SUCCESS
|
||||
39
etc/init.d/grub-common
Executable file
39
etc/init.d/grub-common
Executable file
@@ -0,0 +1,39 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: grub-common
|
||||
# Required-Start: $all
|
||||
# Required-Stop:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop:
|
||||
# Short-Description: Record successful boot for GRUB
|
||||
# Description: GRUB displays the boot menu at the next boot if it
|
||||
# believes that the previous boot failed. This script
|
||||
# informs it that the system booted successfully.
|
||||
### END INIT INFO
|
||||
|
||||
command -v grub-editenv >/dev/null || exit 0
|
||||
|
||||
# Define LSB log_* functions.
|
||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
case $1 in
|
||||
start|restart|force-reload)
|
||||
log_action_msg "Recording successful boot for GRUB"
|
||||
[ -s /boot/grub/grubenv ] || rm -f /boot/grub/grubenv
|
||||
mkdir -p /boot/grub
|
||||
grub-editenv /boot/grub/grubenv unset recordfail
|
||||
log_end_msg $?
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
status)
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
48
etc/init.d/iscsid
Executable file
48
etc/init.d/iscsid
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
|
||||
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
|
||||
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
|
||||
fi
|
||||
### BEGIN INIT INFO
|
||||
# Provides: iscsid
|
||||
# Required-Start: $network $local_fs
|
||||
# Required-Stop: $network $local_fs sendsigs
|
||||
# Default-Start: S
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: iSCSI initiator daemon (iscsid)
|
||||
# Description: The iSCSI initiator daemon takes care of
|
||||
# monitoring iSCSI connections to targets. It is
|
||||
# also the daemon providing the interface for the
|
||||
# iscisadm tool to talk to when administering iSCSI
|
||||
# connections.
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Christian Seiler <christian@iwakd.de>
|
||||
|
||||
DESC="iSCSI initiator daemon"
|
||||
DAEMON=/usr/sbin/iscsid
|
||||
PIDFILE=/run/iscsid.pid
|
||||
OMITDIR=/run/sendsigs.omit.d
|
||||
|
||||
do_start_prepare() {
|
||||
if ! /usr/lib/open-iscsi/startup-checks.sh ; then
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
do_start_cleanup() {
|
||||
ln -sf $PIDFILE $OMITDIR
|
||||
}
|
||||
|
||||
do_stop_override() {
|
||||
# Don't stop iscsid if we're on initramfs or we had some
|
||||
# excluded sessions. We could actually stop it, it's not
|
||||
# required for the kernel to continue working with active
|
||||
# sessions, but it also doesn't hurt to leave it running.
|
||||
if [ -f /etc/iscsi/iscsi.initramfs ] ||
|
||||
( [ -f /run/open-iscsi/shutdown-keep-sessions ] && [ -n "$(cat /run/open-iscsi/shutdown-keep-sessions)" ] )
|
||||
then
|
||||
return
|
||||
fi
|
||||
do_stop "$@"
|
||||
}
|
||||
50
etc/init.d/keyboard-setup.sh
Executable file
50
etc/init.d/keyboard-setup.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: keyboard-setup.sh
|
||||
# Required-Start: mountkernfs
|
||||
# Required-Stop:
|
||||
# X-Start-Before: checkroot
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# X-Interactive: true
|
||||
# Short-Description: Set the console keyboard layout
|
||||
# Description: Set the console keyboard as early as possible
|
||||
# so during the file systems checks the administrator
|
||||
# can interact. At this stage of the boot process
|
||||
# only the ASCII symbols are supported.
|
||||
### END INIT INFO
|
||||
|
||||
if [ -f /bin/setupcon ]; then
|
||||
case "$1" in
|
||||
stop|status)
|
||||
# console-setup isn't a daemon
|
||||
;;
|
||||
start|force-reload|restart|reload)
|
||||
if [ -f /lib/lsb/init-functions ]; then
|
||||
. /lib/lsb/init-functions
|
||||
else
|
||||
log_action_begin_msg () {
|
||||
echo -n "$@... "
|
||||
}
|
||||
|
||||
log_action_end_msg () {
|
||||
if [ "$1" -eq 0 ]; then
|
||||
echo done.
|
||||
else
|
||||
echo failed.
|
||||
fi
|
||||
}
|
||||
fi
|
||||
log_action_begin_msg "Setting up keyboard layout"
|
||||
if /lib/console-setup/keyboard-setup.sh; then
|
||||
log_action_end_msg 0
|
||||
else
|
||||
log_action_end_msg $?
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo 'Usage: /etc/init.d/keyboard-setup.sh {start|reload|restart|force-reload|stop|status}'
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
92
etc/init.d/kmod
Executable file
92
etc/init.d/kmod
Executable file
@@ -0,0 +1,92 @@
|
||||
#!/bin/sh -e
|
||||
### BEGIN INIT INFO
|
||||
# Provides: kmod
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Should-Start: checkroot
|
||||
# Should-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: Load the modules listed in /etc/modules.
|
||||
# Description: Load the modules listed in /etc/modules.
|
||||
### END INIT INFO
|
||||
|
||||
# Silently exit if the kernel does not support modules.
|
||||
[ -f /proc/modules ] || exit 0
|
||||
[ -x /sbin/modprobe ] || exit 0
|
||||
|
||||
[ -f /etc/default/rcS ] && . /etc/default/rcS
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
PATH='/usr/sbin:/usr/bin:/sbin:/bin'
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
;;
|
||||
|
||||
stop|restart|reload|force-reload)
|
||||
log_warning_msg "Action '$1' is meaningless for this init script"
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
log_success_msg "Usage: $0 start"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
load_module() {
|
||||
local module args
|
||||
module="$1"
|
||||
args="$2"
|
||||
|
||||
if [ "$VERBOSE" != no ]; then
|
||||
log_action_msg "Loading kernel module $module"
|
||||
modprobe $module $args || true
|
||||
else
|
||||
modprobe $module $args > /dev/null 2>&1 || true
|
||||
fi
|
||||
}
|
||||
|
||||
modules_files() {
|
||||
local modules_load_dirs='/etc/modules-load.d /run/modules-load.d /usr/local/lib/modules-load.d /usr/lib/modules-load.d'
|
||||
local processed=' '
|
||||
local add_etc_modules=true
|
||||
|
||||
for dir in $modules_load_dirs; do
|
||||
[ -d $dir ] || continue
|
||||
for file in $(run-parts --list --regex='\.conf$' $dir 2> /dev/null || true); do
|
||||
local base=${file##*/}
|
||||
if echo -n "$processed" | grep -qF " $base "; then
|
||||
continue
|
||||
fi
|
||||
if [ "$add_etc_modules" -a -L $file \
|
||||
-a "$(readlink -f $file)" = /etc/modules ]; then
|
||||
add_etc_modules=
|
||||
fi
|
||||
processed="$processed$base "
|
||||
echo $file
|
||||
done
|
||||
done
|
||||
|
||||
if [ "$add_etc_modules" ]; then
|
||||
echo /etc/modules
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$VERBOSE" = no ]; then
|
||||
log_action_begin_msg 'Loading kernel modules'
|
||||
fi
|
||||
|
||||
files=$(modules_files)
|
||||
if [ "$files" ] ; then
|
||||
grep -h '^[^#]' $files |
|
||||
while read module args; do
|
||||
[ "$module" ] || continue
|
||||
load_module "$module" "$args"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$VERBOSE" = no ]; then
|
||||
log_action_end_msg 0
|
||||
fi
|
||||
|
||||
298
etc/init.d/mariadb
Executable file
298
etc/init.d/mariadb
Executable file
@@ -0,0 +1,298 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: mariadb
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Should-Start: $network $named $time
|
||||
# Should-Stop: $network $named $time
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start and stop the MariaDB database server daemon
|
||||
# Description: Controls the main MariaDB database server daemon "mariadbd"
|
||||
# and its wrapper script "mysqld_safe".
|
||||
### END INIT INFO
|
||||
#
|
||||
set -e
|
||||
set -u
|
||||
${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
|
||||
|
||||
test -x /usr/sbin/mariadbd || exit 0
|
||||
|
||||
# shellcheck source=/dev/null
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
SELF="$(cd "$(dirname "$0")"; pwd -P)/$(basename "$0")"
|
||||
|
||||
if [ -f /usr/bin/mariadb-admin ]
|
||||
then
|
||||
MYADMIN="/usr/bin/mariadb-admin --defaults-file=/etc/mysql/debian.cnf"
|
||||
elif [ -f /usr/bin/mysqladmin ]
|
||||
then
|
||||
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
|
||||
else
|
||||
log_failure_msg "Command mariadb-admin/mysqladmin not found! This SysV init script depends on it."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x /usr/bin/mariadbd-safe ]
|
||||
then
|
||||
log_failure_msg "/usr/bin/mariadbd-safe not found or executable! This SysV init script depends on it."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# priority can be overridden and "-s" adds output to stderr
|
||||
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mariadb -i"
|
||||
|
||||
if [ -f /etc/default/mysql ]
|
||||
then
|
||||
# shellcheck source=/dev/null
|
||||
. /etc/default/mysql
|
||||
fi
|
||||
|
||||
# Also source default/mariadb in case the installation was upgraded from
|
||||
# packages originally installed from MariaDB.org repositories, which have
|
||||
# had support for reading /etc/default/mariadb since March 2016.
|
||||
if [ -f /etc/default/mariadb ]
|
||||
then
|
||||
# shellcheck source=/dev/null
|
||||
. /etc/default/mariadb
|
||||
fi
|
||||
|
||||
# Safeguard (relative paths, core dumps..)
|
||||
cd /
|
||||
umask 077
|
||||
|
||||
# mysqladmin likes to read /root/.my.cnf. This is usually not what I want
|
||||
# as many admins e.g. only store a password without a username there and
|
||||
# so break my scripts.
|
||||
export HOME=/etc/mysql/
|
||||
|
||||
## Fetch a particular option from mysql's invocation.
|
||||
#
|
||||
# Usage: void mariadbd_get_param option
|
||||
mariadbd_get_param() {
|
||||
/usr/sbin/mariadbd --print-defaults \
|
||||
| tr " " "\n" \
|
||||
| grep -- "--$1" \
|
||||
| tail -n 1 \
|
||||
| cut -d= -f2
|
||||
}
|
||||
|
||||
## Do some sanity checks before even trying to start mariadbd.
|
||||
sanity_checks() {
|
||||
# check for config file
|
||||
if [ ! -r /etc/mysql/my.cnf ]
|
||||
then
|
||||
log_warning_msg "$0: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz"
|
||||
echo "WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz" | $ERR_LOGGER
|
||||
fi
|
||||
|
||||
# check for diskspace shortage
|
||||
datadir="$(mariadbd_get_param datadir)"
|
||||
|
||||
# If datadir location is not customized in configuration
|
||||
# then it's not printed with /usr/sbin/mariadbd --print-defaults
|
||||
# and this should fall backt to a sane default value
|
||||
if [ -z "$datadir" ]
|
||||
then
|
||||
datadir="/var/lib/mysql"
|
||||
fi
|
||||
|
||||
# Verify the datadir location exists
|
||||
if [ ! -d "$datadir" ] && [ ! -L "$datadir" ]
|
||||
then
|
||||
log_failure_msg "$0: ERROR: Can't locate MariaDB data location at $datadir"
|
||||
echo "ERROR: Can't locate MariaDB data location at $datadir" | $ERR_LOGGER
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024
|
||||
# 4096 blocks is then lower than 4 MB
|
||||
df_available_blocks="$(LC_ALL=C BLOCKSIZE='' df --output=avail "$datadir" | tail -n 1)"
|
||||
if [ "$df_available_blocks" -lt "4096" ]
|
||||
then
|
||||
log_failure_msg "$0: ERROR: The partition with $datadir is too full!"
|
||||
echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
## Checks if there is a server running and if so if it is accessible.
|
||||
#
|
||||
# check_alive insists on a pingable server
|
||||
# check_dead also fails if there is a lost mariadbd in the process list
|
||||
#
|
||||
# Usage: boolean mariadbd_status [check_alive|check_dead] [warn|nowarn]
|
||||
mariadbd_status () {
|
||||
ping_output="$($MYADMIN ping 2>&1)"
|
||||
# The whole mariadbd_status function should be rewritten in clean shell script,
|
||||
# so ignore minor Shellcheck nag for now as fixing it would be half of the
|
||||
# rewrite
|
||||
# shellcheck disable=SC2181
|
||||
ping_alive="$(( ! $? ))"
|
||||
|
||||
ps_alive=0
|
||||
pidfile="$(mariadbd_get_param pid-file)"
|
||||
if [ -f "$pidfile" ] && ps "$(cat "$pidfile")" >/dev/null 2>&1
|
||||
then
|
||||
ps_alive=1
|
||||
fi
|
||||
|
||||
# Using '-a' is unstandard, but it works and might be needed for the grouping
|
||||
# of the if-else, so keep it and just ignore in Shellcheck
|
||||
# shellcheck disable=SC2166
|
||||
if [ "$1" = "check_alive" -a $ping_alive = 1 ] ||
|
||||
[ "$1" = "check_dead" -a $ping_alive = 0 -a $ps_alive = 0 ]
|
||||
then
|
||||
return 0 # EXIT_SUCCESS
|
||||
else
|
||||
if [ "$2" = "warn" ]
|
||||
then
|
||||
echo -e "$ps_alive processes alive and '$MYADMIN ping' resulted in\n$ping_output\n" | $ERR_LOGGER -p daemon.debug
|
||||
fi
|
||||
return 1 # EXIT_FAILURE
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# main()
|
||||
#
|
||||
|
||||
case "${1:-''}" in
|
||||
|
||||
'start')
|
||||
sanity_checks;
|
||||
# Start daemon
|
||||
log_daemon_msg "Starting MariaDB database server" "mariadbd"
|
||||
if mariadbd_status check_alive nowarn
|
||||
then
|
||||
log_progress_msg "already running"
|
||||
log_end_msg 0
|
||||
else
|
||||
# Could be removed during boot
|
||||
test -e /run/mysqld || install -m 755 -o mysql -g root -d /run/mysqld
|
||||
|
||||
# Start MariaDB!
|
||||
/usr/bin/mariadbd-safe "${@:2}" 2>&1 >/dev/null | $ERR_LOGGER &
|
||||
|
||||
for _ in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}")
|
||||
do
|
||||
sleep 1
|
||||
if mariadbd_status check_alive nowarn
|
||||
then
|
||||
break
|
||||
fi
|
||||
log_progress_msg "."
|
||||
done
|
||||
if mariadbd_status check_alive warn
|
||||
then
|
||||
log_end_msg 0
|
||||
# Now start mysqlcheck or whatever the admin wants.
|
||||
output=$(/etc/mysql/debian-start)
|
||||
if [ -n "$output" ]
|
||||
then
|
||||
log_action_msg "$output"
|
||||
fi
|
||||
else
|
||||
# Try one more time but save error log separately, then spit it out
|
||||
# before logging ends and init script execution ends.
|
||||
if pgrep -ax mariadbd > /dev/null
|
||||
then
|
||||
echo "ERROR: The mariadbd process is running but not responding:"
|
||||
# shellcheck disable=SC2009
|
||||
# Show the mariadbd process and it's parent and next line (if there is a child process)
|
||||
ps faxu | grep mariadbd -C 1
|
||||
else
|
||||
ERROR_LOG_FILE="$(mktemp).err"
|
||||
echo # ensure newline
|
||||
timeout --kill-after=20 10 /usr/bin/mysqld_safe "${@:2}" --log-error="$ERROR_LOG_FILE"
|
||||
echo "Running '/etc/init.d/mariadb start' failed with error log:"
|
||||
cat "$ERROR_LOG_FILE"
|
||||
fi
|
||||
|
||||
log_end_msg 1
|
||||
log_failure_msg "Please take a look at the syslog"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
'stop')
|
||||
# * As a passwordless mysqladmin (e.g. via ~/.my.cnf) must be possible
|
||||
# at least for cron, we can rely on it here, too. (although we have
|
||||
# to specify it explicit as e.g. sudo environments points to the normal
|
||||
# users home and not /root)
|
||||
log_daemon_msg "Stopping MariaDB database server" "mariadbd"
|
||||
if ! mariadbd_status check_dead nowarn
|
||||
then
|
||||
set +e
|
||||
shutdown_out="$($MYADMIN shutdown 2>&1)"
|
||||
r=$?
|
||||
set -e
|
||||
if [ "$r" -ne 0 ]
|
||||
then
|
||||
log_end_msg 1
|
||||
[ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out"
|
||||
log_daemon_msg "Killing MariaDB database server by signal" "mariadbd"
|
||||
killall -15 mariadbd || killall -15 mysqld
|
||||
server_down=
|
||||
for _ in {1..600}
|
||||
do
|
||||
sleep 1
|
||||
if mariadbd_status check_dead nowarn
|
||||
then
|
||||
server_down=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -z "$server_down"
|
||||
then
|
||||
killall -9 mariadbd || killall -9 mysqld
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! mariadbd_status check_dead warn
|
||||
then
|
||||
log_end_msg 1
|
||||
log_failure_msg "Please stop MariaDB manually and read /usr/share/doc/mariadb-server/README.Debian.gz!"
|
||||
exit 1
|
||||
else
|
||||
log_end_msg 0
|
||||
fi
|
||||
;;
|
||||
|
||||
'restart')
|
||||
set +e; $SELF stop; set -e
|
||||
shift
|
||||
$SELF start "${@}"
|
||||
;;
|
||||
|
||||
'reload'|'force-reload')
|
||||
log_daemon_msg "Reloading MariaDB database server" "mariadbd"
|
||||
$MYADMIN reload
|
||||
log_end_msg 0
|
||||
;;
|
||||
|
||||
'status')
|
||||
if mariadbd_status check_alive nowarn
|
||||
then
|
||||
log_action_msg "$($MYADMIN version)"
|
||||
else
|
||||
log_action_msg "MariaDB is stopped."
|
||||
exit 3
|
||||
fi
|
||||
;;
|
||||
|
||||
'bootstrap')
|
||||
# Bootstrap the cluster, start the first node
|
||||
# that initiates the cluster
|
||||
log_daemon_msg "Bootstrapping the cluster" "mariadbd"
|
||||
$SELF start "${@:2}" --wsrep-new-cluster
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
86
etc/init.d/monit
Executable file
86
etc/init.d/monit
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: monit
|
||||
# Required-Start: $remote_fs
|
||||
# Required-Stop: $remote_fs
|
||||
# Should-Start: $all
|
||||
# Should-Stop: $all
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: service and resource monitoring daemon
|
||||
# Description: monit is a utility for managing and monitoring
|
||||
# processes, programs, files, directories and filesystems
|
||||
# on a Unix system. Monit conducts automatic maintenance
|
||||
# and repair and can execute meaningful causal actions
|
||||
# in error situations.
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
DAEMON=/usr/bin/monit
|
||||
CONFIG=/etc/monit/monitrc
|
||||
NAME=monit
|
||||
DESC="daemon monitor"
|
||||
MONIT_OPTS=
|
||||
PID="/run/$NAME.pid"
|
||||
|
||||
# Check if DAEMON binary exist
|
||||
[ -f $DAEMON ] || exit 0
|
||||
|
||||
[ -f "/etc/default/$NAME" ] && . /etc/default/$NAME
|
||||
|
||||
MONIT_OPTS="-c $CONFIG $MONIT_OPTS"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_daemon_msg "Starting $DESC" "$NAME"
|
||||
if start-stop-daemon --start --quiet --oknodo --pidfile $PID --exec $DAEMON -- $MONIT_OPTS 1>/dev/null
|
||||
then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
if start-stop-daemon --retry TERM/5/KILL/5 --oknodo --stop --quiet --pidfile $PID 1>/dev/null
|
||||
then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
reload)
|
||||
log_daemon_msg "Reloading $DESC configuration" "$NAME"
|
||||
if start-stop-daemon --stop --signal HUP --quiet --oknodo --pidfile $PID --exec $DAEMON -- $MONIT_OPTS 1>/dev/null
|
||||
then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
restart|force-reload)
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
start-stop-daemon --retry TERM/5/KILL/5 --oknodo --stop --quiet --pidfile $PID 1>/dev/null
|
||||
if start-stop-daemon --start --quiet --oknodo --pidfile $PID --exec $DAEMON -- $MONIT_OPTS 1>/dev/null
|
||||
then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
syntax)
|
||||
$DAEMON $MONIT_OPTS -t
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p $PID $DAEMON $NAME
|
||||
;;
|
||||
*)
|
||||
log_action_msg "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|syntax|status}"
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
196
etc/init.d/nginx
Executable file
196
etc/init.d/nginx
Executable file
@@ -0,0 +1,196 @@
|
||||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: nginx
|
||||
# Required-Start: $local_fs $remote_fs $network $syslog $named
|
||||
# Required-Stop: $local_fs $remote_fs $network $syslog $named
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: starts the nginx web server
|
||||
# Description: starts nginx using start-stop-daemon
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
DAEMON=/usr/sbin/nginx
|
||||
NAME=nginx
|
||||
DESC=nginx
|
||||
|
||||
# Include nginx defaults if available
|
||||
if [ -r /etc/default/nginx ]; then
|
||||
. /etc/default/nginx
|
||||
fi
|
||||
|
||||
STOP_SCHEDULE="${STOP_SCHEDULE:-QUIT/5/TERM/5/KILL/5}"
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
. /lib/init/vars.sh
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# Try to extract nginx pidfile
|
||||
PID=$(cat /etc/nginx/nginx.conf | grep -Ev '^\s*#' | awk 'BEGIN { RS="[;{}]" } { if ($1 == "pid") print $2 }' | head -n1)
|
||||
if [ -z "$PID" ]; then
|
||||
PID=/run/nginx.pid
|
||||
fi
|
||||
|
||||
if [ -n "$ULIMIT" ]; then
|
||||
# Set ulimit if it is set in /etc/default/nginx
|
||||
ulimit $ULIMIT
|
||||
fi
|
||||
|
||||
start_nginx() {
|
||||
# Start the daemon/service
|
||||
#
|
||||
# Returns:
|
||||
# 0 if daemon has been started
|
||||
# 1 if daemon was already running
|
||||
# 2 if daemon could not be started
|
||||
start-stop-daemon --start --quiet --pidfile $PID --exec $DAEMON --test > /dev/null \
|
||||
|| return 1
|
||||
start-stop-daemon --start --quiet --pidfile $PID --exec $DAEMON -- \
|
||||
$DAEMON_OPTS 2>/dev/null \
|
||||
|| return 2
|
||||
}
|
||||
|
||||
test_config() {
|
||||
# Test the nginx configuration
|
||||
$DAEMON -t $DAEMON_OPTS >/dev/null 2>&1
|
||||
}
|
||||
|
||||
stop_nginx() {
|
||||
# Stops the daemon/service
|
||||
#
|
||||
# Return
|
||||
# 0 if daemon has been stopped
|
||||
# 1 if daemon was already stopped
|
||||
# 2 if daemon could not be stopped
|
||||
# other if a failure occurred
|
||||
start-stop-daemon --stop --quiet --retry=$STOP_SCHEDULE --pidfile $PID --name $NAME
|
||||
RETVAL="$?"
|
||||
sleep 1
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
reload_nginx() {
|
||||
# Function that sends a SIGHUP to the daemon/service
|
||||
start-stop-daemon --stop --signal HUP --quiet --pidfile $PID --name $NAME
|
||||
return 0
|
||||
}
|
||||
|
||||
rotate_logs() {
|
||||
# Rotate log files
|
||||
start-stop-daemon --stop --signal USR1 --quiet --pidfile $PID --name $NAME
|
||||
return 0
|
||||
}
|
||||
|
||||
upgrade_nginx() {
|
||||
# Online upgrade nginx executable
|
||||
# http://nginx.org/en/docs/control.html
|
||||
#
|
||||
# Return
|
||||
# 0 if nginx has been successfully upgraded
|
||||
# 1 if nginx is not running
|
||||
# 2 if the pid files were not created on time
|
||||
# 3 if the old master could not be killed
|
||||
if start-stop-daemon --stop --signal USR2 --quiet --pidfile $PID --name $NAME; then
|
||||
# Wait for both old and new master to write their pid file
|
||||
while [ ! -s "${PID}.oldbin" ] || [ ! -s "${PID}" ]; do
|
||||
cnt=`expr $cnt + 1`
|
||||
if [ $cnt -gt 10 ]; then
|
||||
return 2
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# Everything is ready, gracefully stop the old master
|
||||
if start-stop-daemon --stop --signal QUIT --quiet --pidfile "${PID}.oldbin" --name $NAME; then
|
||||
return 0
|
||||
else
|
||||
return 3
|
||||
fi
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_daemon_msg "Starting $DESC" "$NAME"
|
||||
start_nginx
|
||||
case "$?" in
|
||||
0|1) log_end_msg 0 ;;
|
||||
2) log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
stop_nginx
|
||||
case "$?" in
|
||||
0|1) log_end_msg 0 ;;
|
||||
2) log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
restart)
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
|
||||
# Check configuration before stopping nginx
|
||||
if ! test_config; then
|
||||
log_end_msg 1 # Configuration error
|
||||
exit $?
|
||||
fi
|
||||
|
||||
stop_nginx
|
||||
case "$?" in
|
||||
0|1)
|
||||
start_nginx
|
||||
case "$?" in
|
||||
0) log_end_msg 0 ;;
|
||||
1) log_end_msg 1 ;; # Old process is still running
|
||||
*) log_end_msg 1 ;; # Failed to start
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
# Failed to stop
|
||||
log_end_msg 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
reload|force-reload)
|
||||
log_daemon_msg "Reloading $DESC configuration" "$NAME"
|
||||
|
||||
# Check configuration before stopping nginx
|
||||
#
|
||||
# This is not entirely correct since the on-disk nginx binary
|
||||
# may differ from the in-memory one, but that's not common.
|
||||
# We prefer to check the configuration and return an error
|
||||
# to the administrator.
|
||||
if ! test_config; then
|
||||
log_end_msg 1 # Configuration error
|
||||
exit $?
|
||||
fi
|
||||
|
||||
reload_nginx
|
||||
log_end_msg $?
|
||||
;;
|
||||
configtest|testconfig)
|
||||
log_daemon_msg "Testing $DESC configuration"
|
||||
test_config
|
||||
log_end_msg $?
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p $PID "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||
;;
|
||||
upgrade)
|
||||
log_daemon_msg "Upgrading binary" "$NAME"
|
||||
upgrade_nginx
|
||||
log_end_msg $?
|
||||
;;
|
||||
rotate)
|
||||
log_daemon_msg "Re-opening $DESC log files" "$NAME"
|
||||
rotate_logs
|
||||
log_end_msg $?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $NAME {start|stop|restart|reload|force-reload|status|configtest|rotate|upgrade}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
113
etc/init.d/open-iscsi
Executable file
113
etc/init.d/open-iscsi
Executable file
@@ -0,0 +1,113 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: open-iscsi iscsi
|
||||
# Required-Start: $network $local_fs iscsid
|
||||
# Required-Stop: $network $local_fs iscsid sendsigs
|
||||
# Default-Start: S
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Login to default iSCSI targets
|
||||
# Description: Login to default iSCSI targets at boot and log out
|
||||
# of all iSCSI targets at shutdown.
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/usr/sbin:/sbin:/usr/bin:/bin
|
||||
DAEMON=/usr/sbin/iscsid
|
||||
ADM=/usr/sbin/iscsiadm
|
||||
PIDFILE=/run/iscsid.pid
|
||||
NAMEFILE=/etc/iscsi/initiatorname.iscsi
|
||||
CONFIGFILE=/etc/iscsi/iscsid.conf
|
||||
OMITDIR=/run/sendsigs.omit.d
|
||||
|
||||
[ -x "$DAEMON" ] || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# Include defaults if available
|
||||
if [ -f /etc/default/open-iscsi ]; then
|
||||
. /etc/default/open-iscsi
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -d /sys/class/ ]; then
|
||||
log_failure_msg "iSCSI requires a mounted sysfs, not started."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
RETVAL=0
|
||||
|
||||
start() {
|
||||
if ! [ -s $PIDFILE ] || ! kill -0 `sed -n 1p $PIDFILE` >/dev/null ; then
|
||||
log_failure_msg "iSCSI initiator daemon not started: not logging in to default targets"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
starttargets
|
||||
|
||||
# activate LVM, mount filesystems, etc.
|
||||
/usr/lib/open-iscsi/activate-storage.sh
|
||||
}
|
||||
|
||||
starttargets() {
|
||||
log_daemon_msg "Setting up iSCSI targets"
|
||||
echo
|
||||
$ADM -m node --loginall=automatic
|
||||
log_end_msg 0
|
||||
}
|
||||
|
||||
stoptargets() {
|
||||
log_daemon_msg "Disconnecting iSCSI targets"
|
||||
sync
|
||||
# only logout if daemon is running, iscsiadm hangs otherwise
|
||||
if [ -s $PIDFILE ] && kill -0 `sed -n 1p $PIDFILE` >/dev/null ; then
|
||||
/usr/lib/open-iscsi/logout-all.sh
|
||||
fi
|
||||
|
||||
log_end_msg 0
|
||||
}
|
||||
|
||||
stop() {
|
||||
# Call umountiscsi.sh to unmount iSCSI devices first (always do
|
||||
# that, regardless of whether root is on iSCSI, umountiscsi.sh
|
||||
# will exclude it - and even if that shouldn't work, the mount
|
||||
# point will be busy)
|
||||
log_daemon_msg "Umounting iSCSI filesystems"
|
||||
/usr/lib/open-iscsi/umountiscsi.sh
|
||||
umount_exit_status=$?
|
||||
log_end_msg $umount_exit_status
|
||||
|
||||
if [ $umount_exit_status -ne 0 ]; then
|
||||
log_failure_msg "Couldn't unmount all iSCSI devices. not logging out from any target."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
stoptargets
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
restarttargets() {
|
||||
stoptargets
|
||||
starttargets
|
||||
}
|
||||
|
||||
status() {
|
||||
echo Current active iSCSI sessions:
|
||||
$ADM -m session
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|starttargets|stop|stoptargets|restart|restarttargets|status)
|
||||
$1
|
||||
;;
|
||||
force-reload)
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
exit $RETVAL
|
||||
64
etc/init.d/open-vm-tools
Executable file
64
etc/init.d/open-vm-tools
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: open-vm-tools
|
||||
# Required-Start: $local_fs $remote_fs
|
||||
# Required-Stop: $local_fs $remote_fs
|
||||
# X-Start-Before:
|
||||
# X-Stop-After:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Description: Runs the open-vm-tools services
|
||||
# Short-Description: Runs the open-vm-tools services
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
exit_if_not_in_vm () {
|
||||
if which systemd-detect-virt 1>/dev/null; then
|
||||
checktool='systemd-detect-virt'
|
||||
else
|
||||
checktool='vmware-checkvm'
|
||||
fi
|
||||
|
||||
if ! ${checktool} | grep -iq vmware; then
|
||||
echo "open-vm-tools: not starting as this is not a VMware VM"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
# Check if we're running inside VMWare
|
||||
exit_if_not_in_vm
|
||||
|
||||
log_daemon_msg "Starting open-vm daemon" "vmtoolsd"
|
||||
start-stop-daemon --start --quiet --pidfile /var/run/vmtoolsd.pid --exec /usr/bin/vmtoolsd --test > /dev/null || exit 1
|
||||
start-stop-daemon --start --quiet --pidfile /var/run/vmtoolsd.pid --exec /usr/bin/vmtoolsd -- --background /var/run/vmtoolsd.pid || exit 2
|
||||
log_end_msg 0
|
||||
;;
|
||||
|
||||
stop)
|
||||
log_daemon_msg "Stopping open-vm guest daemon" "vmtoolsd"
|
||||
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile /var/run/vmtoolsd.pid --exec /usr/bin/vmtoolsd
|
||||
RETURN="${?}"
|
||||
[ "${RETURN}" = 2 ] && exit 2
|
||||
# Many daemons don't delete their pidfiles when they exit.
|
||||
rm -f /var/run/vmtoolsd.pid
|
||||
log_end_msg 0
|
||||
;;
|
||||
|
||||
force-reload|restart)
|
||||
${0} stop
|
||||
${0} start
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc -p /var/run/vmtoolsd.pid /usr/bin/vmtoolsd vmtoolsd && exit 0 || exit $?
|
||||
;;
|
||||
|
||||
*)
|
||||
log_success_msg "Usage: ${0} {start|stop|restart|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
298
etc/init.d/openvpn
Executable file
298
etc/init.d/openvpn
Executable file
@@ -0,0 +1,298 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: openvpn
|
||||
# Required-Start: $network $remote_fs $syslog
|
||||
# Required-Stop: $network $remote_fs $syslog
|
||||
# Should-Start: network-manager
|
||||
# Should-Stop: network-manager
|
||||
# X-Start-Before: $x-display-manager gdm kdm xdm wdm ldm sdm nodm
|
||||
# X-Interactive: true
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Openvpn VPN service
|
||||
# Description: This script will start OpenVPN tunnels as specified
|
||||
# in /etc/default/openvpn and /etc/openvpn/*.conf
|
||||
### END INIT INFO
|
||||
|
||||
# Original version by Robert Leslie
|
||||
# <rob@mars.org>, edited by iwj and cs
|
||||
# Modified for openvpn by Alberto Gonzalez Iniesta <agi@inittab.org>
|
||||
# Modified for restarting / starting / stopping single tunnels by Richard Mueller <mueller@teamix.net>
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
test $DEBIAN_SCRIPT_DEBUG && set -v -x
|
||||
|
||||
DAEMON=/usr/sbin/openvpn
|
||||
DESC="virtual private network daemon"
|
||||
CONFIG_DIR=/etc/openvpn
|
||||
test -x $DAEMON || exit 0
|
||||
test -d $CONFIG_DIR || exit 0
|
||||
|
||||
# Source defaults file; edit that file to configure this script.
|
||||
AUTOSTART="all"
|
||||
STATUSREFRESH=10
|
||||
OMIT_SENDSIGS=0
|
||||
if test -e /etc/default/openvpn ; then
|
||||
. /etc/default/openvpn
|
||||
fi
|
||||
|
||||
start_vpn () {
|
||||
if grep -q '^[ ]*daemon' $CONFIG_DIR/$NAME.conf ; then
|
||||
# daemon already given in config file
|
||||
DAEMONARG=
|
||||
else
|
||||
# need to daemonize
|
||||
DAEMONARG="--daemon ovpn-$NAME"
|
||||
fi
|
||||
|
||||
if grep -q '^[ ]*status ' $CONFIG_DIR/$NAME.conf ; then
|
||||
# status file already given in config file
|
||||
STATUSARG=""
|
||||
elif test $STATUSREFRESH -eq 0 ; then
|
||||
# default status file disabled in /etc/default/openvpn
|
||||
STATUSARG=""
|
||||
else
|
||||
# prepare default status file
|
||||
STATUSARG="--status /run/openvpn/$NAME.status $STATUSREFRESH"
|
||||
fi
|
||||
|
||||
# tun using the "subnet" topology confuses the routing code that wrongly
|
||||
# emits ICMP redirects for client to client communications
|
||||
SAVED_DEFAULT_SEND_REDIRECTS=0
|
||||
if grep -q '^[[:space:]]*dev[[:space:]]*tun' $CONFIG_DIR/$NAME.conf && \
|
||||
grep -q '^[[:space:]]*topology[[:space:]]*subnet' $CONFIG_DIR/$NAME.conf ; then
|
||||
# When using "client-to-client", OpenVPN routes the traffic itself without
|
||||
# involving the TUN/TAP interface so no ICMP redirects are sent
|
||||
if ! grep -q '^[[:space:]]*client-to-client' $CONFIG_DIR/$NAME.conf ; then
|
||||
sysctl -w net.ipv4.conf.all.send_redirects=0 > /dev/null
|
||||
|
||||
# Save the default value for send_redirects before disabling it
|
||||
# to make sure the tun device is created with send_redirects disabled
|
||||
SAVED_DEFAULT_SEND_REDIRECTS=$(sysctl -n net.ipv4.conf.default.send_redirects)
|
||||
|
||||
if [ "$SAVED_DEFAULT_SEND_REDIRECTS" -ne 0 ]; then
|
||||
sysctl -w net.ipv4.conf.default.send_redirects=0 > /dev/null
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
log_progress_msg "$NAME"
|
||||
STATUS=0
|
||||
|
||||
start-stop-daemon --start --quiet --oknodo \
|
||||
--pidfile /run/openvpn/$NAME.pid \
|
||||
--exec $DAEMON -- $OPTARGS --writepid /run/openvpn/$NAME.pid \
|
||||
$DAEMONARG $STATUSARG --cd $CONFIG_DIR \
|
||||
--config $CONFIG_DIR/$NAME.conf || STATUS=1
|
||||
|
||||
[ "$OMIT_SENDSIGS" -ne 1 ] || ln -s /run/openvpn/$NAME.pid /run/sendsigs.omit.d/openvpn.$NAME.pid
|
||||
|
||||
# Set the back the original default value of send_redirects if it was changed
|
||||
if [ "$SAVED_DEFAULT_SEND_REDIRECTS" -ne 0 ]; then
|
||||
sysctl -w net.ipv4.conf.default.send_redirects=$SAVED_DEFAULT_SEND_REDIRECTS > /dev/null
|
||||
fi
|
||||
}
|
||||
stop_vpn () {
|
||||
start-stop-daemon --stop --quiet --oknodo \
|
||||
--pidfile $PIDFILE --exec $DAEMON --retry 10
|
||||
if [ "$?" -eq 0 ]; then
|
||||
rm -f $PIDFILE
|
||||
[ "$OMIT_SENDSIGS" -ne 1 ] || rm -f /run/sendsigs.omit.d/openvpn.$NAME.pid
|
||||
rm -f /run/openvpn/$NAME.status 2> /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_daemon_msg "Starting $DESC"
|
||||
|
||||
# first create /run directory so it's present even
|
||||
# when no VPN are autostarted by this script, but later
|
||||
# by systemd openvpn@.service
|
||||
mkdir -p /run/openvpn
|
||||
|
||||
# autostart VPNs
|
||||
if test -z "$2" ; then
|
||||
# check if automatic startup is disabled by AUTOSTART=none
|
||||
if test "x$AUTOSTART" = "xnone" -o -z "$AUTOSTART" ; then
|
||||
log_warning_msg " Autostart disabled."
|
||||
exit 0
|
||||
fi
|
||||
if test -z "$AUTOSTART" -o "x$AUTOSTART" = "xall" ; then
|
||||
# all VPNs shall be started automatically
|
||||
for CONFIG in `cd $CONFIG_DIR; ls *.conf 2> /dev/null`; do
|
||||
NAME=${CONFIG%%.conf}
|
||||
start_vpn
|
||||
done
|
||||
else
|
||||
# start only specified VPNs
|
||||
for NAME in $AUTOSTART ; do
|
||||
if test -e $CONFIG_DIR/$NAME.conf ; then
|
||||
start_vpn
|
||||
else
|
||||
log_failure_msg "No such VPN: $NAME"
|
||||
STATUS=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
#start VPNs from command line
|
||||
else
|
||||
while shift ; do
|
||||
[ -z "$1" ] && break
|
||||
if test -e $CONFIG_DIR/$1.conf ; then
|
||||
NAME=$1
|
||||
start_vpn
|
||||
else
|
||||
log_failure_msg " No such VPN: $1"
|
||||
STATUS=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
log_end_msg ${STATUS:-0}
|
||||
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping $DESC"
|
||||
|
||||
if test -z "$2" ; then
|
||||
for PIDFILE in `ls /run/openvpn/*.pid 2> /dev/null`; do
|
||||
NAME=`echo $PIDFILE | cut -c14-`
|
||||
NAME=${NAME%%.pid}
|
||||
stop_vpn
|
||||
log_progress_msg "$NAME"
|
||||
done
|
||||
else
|
||||
while shift ; do
|
||||
[ -z "$1" ] && break
|
||||
if test -e /run/openvpn/$1.pid ; then
|
||||
PIDFILE=`ls /run/openvpn/$1.pid 2> /dev/null`
|
||||
NAME=`echo $PIDFILE | cut -c14-`
|
||||
NAME=${NAME%%.pid}
|
||||
stop_vpn
|
||||
log_progress_msg "$NAME"
|
||||
else
|
||||
log_failure_msg " (failure: No such VPN is running: $1)"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
log_end_msg 0
|
||||
;;
|
||||
# Only 'reload' running VPNs. New ones will only start with 'start' or 'restart'.
|
||||
reload|force-reload)
|
||||
log_daemon_msg "Reloading $DESC"
|
||||
for PIDFILE in `ls /run/openvpn/*.pid 2> /dev/null`; do
|
||||
NAME=`echo $PIDFILE | cut -c14-`
|
||||
NAME=${NAME%%.pid}
|
||||
# If openvpn if running under a different user than root we'll need to restart
|
||||
if egrep '^[[:blank:]]*user[[:blank:]]' $CONFIG_DIR/$NAME.conf > /dev/null 2>&1 ; then
|
||||
stop_vpn
|
||||
start_vpn
|
||||
log_progress_msg "(restarted)"
|
||||
else
|
||||
kill -HUP `cat $PIDFILE` || true
|
||||
log_progress_msg "$NAME"
|
||||
fi
|
||||
done
|
||||
log_end_msg 0
|
||||
;;
|
||||
|
||||
# Only 'soft-restart' running VPNs. New ones will only start with 'start' or 'restart'.
|
||||
soft-restart)
|
||||
log_daemon_msg "$DESC sending SIGUSR1"
|
||||
for PIDFILE in `ls /run/openvpn/*.pid 2> /dev/null`; do
|
||||
NAME=`echo $PIDFILE | cut -c14-`
|
||||
NAME=${NAME%%.pid}
|
||||
kill -USR1 `cat $PIDFILE` || true
|
||||
log_progress_msg "$NAME"
|
||||
done
|
||||
log_end_msg 0
|
||||
;;
|
||||
|
||||
restart)
|
||||
shift
|
||||
$0 stop ${@}
|
||||
$0 start ${@}
|
||||
;;
|
||||
cond-restart)
|
||||
log_daemon_msg "Restarting $DESC."
|
||||
for PIDFILE in `ls /run/openvpn/*.pid 2> /dev/null`; do
|
||||
NAME=`echo $PIDFILE | cut -c14-`
|
||||
NAME=${NAME%%.pid}
|
||||
stop_vpn
|
||||
start_vpn
|
||||
done
|
||||
log_end_msg 0
|
||||
;;
|
||||
status)
|
||||
GLOBAL_STATUS=0
|
||||
if test -z "$2" ; then
|
||||
# We want status for all defined VPNs.
|
||||
# Returns success if all autostarted VPNs are defined and running
|
||||
if test "x$AUTOSTART" = "xnone" ; then
|
||||
# Consider it a failure if AUTOSTART=none
|
||||
log_warning_msg "No VPN autostarted"
|
||||
GLOBAL_STATUS=1
|
||||
else
|
||||
if ! test -z "$AUTOSTART" -o "x$AUTOSTART" = "xall" ; then
|
||||
# Consider it a failure if one of the autostarted VPN is not defined
|
||||
for VPN in $AUTOSTART ; do
|
||||
if ! test -f $CONFIG_DIR/$VPN.conf ; then
|
||||
log_warning_msg "VPN '$VPN' is in AUTOSTART but is not defined"
|
||||
GLOBAL_STATUS=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
for CONFIG in `cd $CONFIG_DIR; ls *.conf 2> /dev/null`; do
|
||||
NAME=${CONFIG%%.conf}
|
||||
# Is it an autostarted VPN ?
|
||||
if test -z "$AUTOSTART" -o "x$AUTOSTART" = "xall" ; then
|
||||
AUTOVPN=1
|
||||
else
|
||||
if test "x$AUTOSTART" = "xnone" ; then
|
||||
AUTOVPN=0
|
||||
else
|
||||
AUTOVPN=0
|
||||
for VPN in $AUTOSTART; do
|
||||
if test "x$VPN" = "x$NAME" ; then
|
||||
AUTOVPN=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
if test "x$AUTOVPN" = "x1" ; then
|
||||
# If it is autostarted, then it contributes to global status
|
||||
status_of_proc -p /run/openvpn/${NAME}.pid openvpn "VPN '${NAME}'" || GLOBAL_STATUS=1
|
||||
else
|
||||
status_of_proc -p /run/openvpn/${NAME}.pid openvpn "VPN '${NAME}' (non autostarted)" || true
|
||||
fi
|
||||
done
|
||||
else
|
||||
# We just want status for specified VPNs.
|
||||
# Returns success if all specified VPNs are defined and running
|
||||
while shift ; do
|
||||
[ -z "$1" ] && break
|
||||
NAME=$1
|
||||
if test -e $CONFIG_DIR/$NAME.conf ; then
|
||||
# Config exists
|
||||
status_of_proc -p /run/openvpn/${NAME}.pid openvpn "VPN '${NAME}'" || GLOBAL_STATUS=1
|
||||
else
|
||||
# Config does not exist
|
||||
log_warning_msg "VPN '$NAME': missing $CONFIG_DIR/$NAME.conf file !"
|
||||
GLOBAL_STATUS=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
exit $GLOBAL_STATUS
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|reload|restart|force-reload|cond-restart|soft-restart|status}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# vim:set ai sts=2 sw=2 tw=0:
|
||||
146
etc/init.d/pcscd
Executable file
146
etc/init.d/pcscd
Executable file
@@ -0,0 +1,146 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: pcscd
|
||||
# Required-Start: $local_fs $remote_fs $syslog
|
||||
# Required-Stop: $local_fs $remote_fs $syslog
|
||||
# Should-Start: udev
|
||||
# Should-Stop: udev
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Daemon to access a smart card using PC/SC
|
||||
# Description: The PC/SC daemon is used to dynamically
|
||||
# allocate/deallocate reader drivers at runtime and manage
|
||||
# connections to the readers.
|
||||
### END INIT INFO
|
||||
|
||||
# Authors:
|
||||
# Carlos Prados Bocos <cprados@debian.org>
|
||||
# Ludovic Rousseau <rousseau@debian.org>
|
||||
|
||||
# Do NOT "set -e"
|
||||
|
||||
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="PCSC Lite resource manager"
|
||||
NAME=pcscd
|
||||
DAEMON=/usr/sbin/$NAME
|
||||
IPCDIR=/var/run/pcscd
|
||||
PIDFILE=$IPCDIR/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
# if you need to pass arguments to pcscd you should edit the file
|
||||
# /etc/default/pcscd and add a line
|
||||
# DAEMON_ARGS="--your-option"
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x "$DAEMON" ] || exit 0
|
||||
|
||||
# Read configuration variable file if it is present
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
|
||||
# Load the VERBOSE setting and other rcS variables
|
||||
. /lib/init/vars.sh
|
||||
|
||||
# Define LSB log_* functions.
|
||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# get LANG variable (code from /etc/init.d/keymap.sh)
|
||||
ENV_FILE="none"
|
||||
[ -r /etc/environment ] && ENV_FILE="/etc/environment"
|
||||
[ -r /etc/default/locale ] && ENV_FILE="/etc/default/locale"
|
||||
|
||||
value=$(grep -E "^[^#]*LANG=" $ENV_FILE | tail -n1 | cut -d= -f2)
|
||||
eval LANG=$value
|
||||
|
||||
#
|
||||
# Function that starts the daemon/service
|
||||
#
|
||||
do_start()
|
||||
{
|
||||
# create $IPCDIR with correct access rights
|
||||
if [ ! -d $IPCDIR ]
|
||||
then
|
||||
rm -rf $IPCDIR
|
||||
mkdir $IPCDIR
|
||||
fi
|
||||
chmod 0755 $IPCDIR
|
||||
|
||||
# Return
|
||||
# 0 if daemon has been started
|
||||
# 1 if daemon was already running
|
||||
# 2 if daemon could not be started
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|
||||
|| return 1
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
||||
$DAEMON_ARGS \
|
||||
|| return 2
|
||||
# Add code here, if necessary, that waits for the process to be ready
|
||||
# to handle requests from services started subsequently which depend
|
||||
# on this one. As a last resort, sleep for some time.
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service
|
||||
#
|
||||
do_stop()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been stopped
|
||||
# 1 if daemon was already stopped
|
||||
# 2 if daemon could not be stopped
|
||||
# other if a failure occurred
|
||||
start-stop-daemon --stop --quiet --retry=3 --pidfile $PIDFILE --name $NAME
|
||||
RETVAL="$?"
|
||||
[ "$RETVAL" = 2 ] && return 2
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||
do_start
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||
;;
|
||||
restart|force-reload)
|
||||
#
|
||||
# If the "reload" option is implemented then remove the
|
||||
# 'force-reload' alias
|
||||
#
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1)
|
||||
do_start
|
||||
case "$?" in
|
||||
0) log_end_msg 0 ;;
|
||||
1) log_end_msg 1 ;; # Old process is still running
|
||||
*) log_end_msg 1 ;; # Failed to start
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
# Failed to stop
|
||||
log_end_msg 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
:
|
||||
161
etc/init.d/php8.3-fpm
Executable file
161
etc/init.d/php8.3-fpm
Executable file
@@ -0,0 +1,161 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: php8.3-fpm
|
||||
# Required-Start: $remote_fs $network
|
||||
# Required-Stop: $remote_fs $network
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: starts php8.3-fpm
|
||||
# Description: Starts The PHP FastCGI Process Manager Daemon
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Ondrej Sury <ondrej@debian.org>
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="PHP 8.3 FastCGI Process Manager"
|
||||
NAME=php-fpm8.3
|
||||
CONFFILE=/etc/php/8.3/fpm/php-fpm.conf
|
||||
DAEMON=/usr/sbin/$NAME
|
||||
DAEMON_ARGS="--daemonize --fpm-config $CONFFILE"
|
||||
CONF_PIDFILE=$(sed -n 's/^pid[ =]*//p' $CONFFILE)
|
||||
PIDFILE=${CONF_PIDFILE:-/run/php/php8.3-fpm.pid}
|
||||
TIMEOUT=30
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x "$DAEMON" ] || exit 0
|
||||
|
||||
# Read configuration variable file if it is present
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
|
||||
# Load the VERBOSE setting and other rcS variables
|
||||
. /lib/init/vars.sh
|
||||
|
||||
# Define LSB log_* functions.
|
||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
#
|
||||
# Function that starts the daemon/service
|
||||
#
|
||||
do_start()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been started
|
||||
# 1 if daemon was already running
|
||||
# 2 if daemon could not be started
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|
||||
|| return 1
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
||||
$DAEMON_ARGS 2>/dev/null \
|
||||
|| return 2
|
||||
# Add code here, if necessary, that waits for the process to be ready
|
||||
# to handle requests from services started subsequently which depend
|
||||
# on this one. As a last resort, sleep for some time.
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service
|
||||
#
|
||||
do_stop()
|
||||
{
|
||||
# Return
|
||||
# 0 if daemon has been stopped
|
||||
# 1 if daemon was already stopped
|
||||
# 2 if daemon could not be stopped
|
||||
# other if a failure occurred
|
||||
start-stop-daemon --stop --quiet --retry=QUIT/$TIMEOUT/TERM/5/KILL/5 --pidfile $PIDFILE --name $NAME
|
||||
RETVAL="$?"
|
||||
[ "$RETVAL" = 2 ] && return 2
|
||||
# Wait for children to finish too if this is a daemon that forks
|
||||
# and if the daemon is only ever run from this initscript.
|
||||
# If the above conditions are not satisfied then add some other code
|
||||
# that waits for the process to drop all resources that could be
|
||||
# needed by services started subsequently. A last resort is to
|
||||
# sleep for some time.
|
||||
start-stop-daemon --stop --quiet --oknodo --retry=0/30/TERM/5/KILL/5 --exec $DAEMON
|
||||
[ "$?" = 2 ] && return 2
|
||||
# Many daemons don't delete their pidfiles when they exit.
|
||||
rm -f $PIDFILE
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
#
|
||||
# Function that sends a SIGHUP to the daemon/service
|
||||
#
|
||||
do_reload() {
|
||||
#
|
||||
# If the daemon can reload its configuration without
|
||||
# restarting (for example, when it is sent a SIGHUP),
|
||||
# then implement that here.
|
||||
#
|
||||
start-stop-daemon --stop --signal USR2 --quiet --pidfile $PIDFILE --name $NAME
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||
systemd-tmpfiles --remove --create /usr/lib/tmpfiles.d/php8.3-fpm.conf
|
||||
case "$?" in
|
||||
0)
|
||||
do_start
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
1) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
status)
|
||||
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||
;;
|
||||
reload|force-reload)
|
||||
log_daemon_msg "Reloading $DESC" "$NAME"
|
||||
do_reload
|
||||
log_end_msg $?
|
||||
;;
|
||||
reopen-logs)
|
||||
log_daemon_msg "Reopening $DESC logs" $NAME
|
||||
if start-stop-daemon --stop --signal USR1 --oknodo --quiet \
|
||||
--pidfile $PIDFILE --exec $DAEMON
|
||||
then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1)
|
||||
do_start
|
||||
case "$?" in
|
||||
0) log_end_msg 0 ;;
|
||||
1) log_end_msg 1 ;; # Old process is still running
|
||||
*) log_end_msg 1 ;; # Failed to start
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
# Failed to stop
|
||||
log_end_msg 1
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
:
|
||||
89
etc/init.d/plymouth
Executable file
89
etc/init.d/plymouth
Executable file
@@ -0,0 +1,89 @@
|
||||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: plymouth
|
||||
# Required-Start: udev $remote_fs $all
|
||||
# Required-Stop: $remote_fs
|
||||
# Should-Start: $x-display-manager
|
||||
# Should-Stop: $x-display-manager
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Stop plymouth during boot and start it on shutdown
|
||||
### END INIT INFO
|
||||
|
||||
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
|
||||
NAME="plymouth"
|
||||
DESC="Boot splash manager"
|
||||
|
||||
test -x /usr/sbin/plymouthd || exit 0
|
||||
|
||||
if [ -r "/etc/default/${NAME}" ]
|
||||
then
|
||||
. "/etc/default/${NAME}"
|
||||
fi
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
set -e
|
||||
|
||||
SPLASH="true"
|
||||
for ARGUMENT in $(cat /proc/cmdline)
|
||||
do
|
||||
case "${ARGUMENT}" in
|
||||
splash*)
|
||||
SPLASH="true"
|
||||
;;
|
||||
|
||||
nosplash*|plymouth.enable=0)
|
||||
SPLASH="false"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
case "${SPLASH}" in
|
||||
true)
|
||||
/usr/bin/plymouth quit --retain-splash
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
stop)
|
||||
case "${SPLASH}" in
|
||||
true)
|
||||
if ! plymouth --ping
|
||||
then
|
||||
/usr/sbin/plymouthd --mode=shutdown
|
||||
fi
|
||||
|
||||
RUNLEVEL="$(/sbin/runlevel | cut -d " " -f 2)"
|
||||
|
||||
case "${RUNLEVEL}" in
|
||||
0)
|
||||
TEXT="Shutting down system..."
|
||||
;;
|
||||
|
||||
6)
|
||||
TEXT="Restarting system..."
|
||||
;;
|
||||
esac
|
||||
|
||||
/usr/bin/plymouth message --text="${TEXT}"
|
||||
|
||||
/usr/bin/plymouth --show-splash
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
restart|force-reload)
|
||||
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: ${0} {start|stop|restart|force-reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
47
etc/init.d/plymouth-log
Executable file
47
etc/init.d/plymouth-log
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: plymouth-log
|
||||
# Required-Start: $local_fs $remote_fs
|
||||
# Required-Stop: $local_fs $remote_fs
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: Inform plymouth that /var/log is writable
|
||||
### END INIT INFO
|
||||
|
||||
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
|
||||
NAME="plymouth-log"
|
||||
DESC="Boot splash manager (write log file)"
|
||||
|
||||
test -x /usr/bin/plymouth || exit 0
|
||||
|
||||
if [ -r "/etc/default/${NAME}" ]
|
||||
then
|
||||
. "/etc/default/${NAME}"
|
||||
fi
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
set -e
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
if plymouth --ping
|
||||
then
|
||||
/usr/bin/plymouth update-root-fs --read-write
|
||||
fi
|
||||
;;
|
||||
|
||||
stop|restart|force-reload)
|
||||
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: ${0} {start|stop|restart|force-reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
129
etc/init.d/postfix
Executable file
129
etc/init.d/postfix
Executable file
@@ -0,0 +1,129 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Start or stop Postfix
|
||||
#
|
||||
# LaMont Jones <lamont@debian.org>
|
||||
# based on sendmail's init.d script
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: postfix mail-transport-agent
|
||||
# Required-Start: $local_fs $remote_fs $syslog $named $network $time
|
||||
# Required-Stop: $local_fs $remote_fs $syslog $named $network
|
||||
# Should-Start: postgresql mysql clamav-daemon postgrey spamassassin saslauthd dovecot
|
||||
# Should-Stop: postgresql mysql clamav-daemon postgrey spamassassin saslauthd dovecot
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Postfix Mail Transport Agent
|
||||
# Description: postfix is a Mail Transport agent
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
DAEMON=/usr/sbin/postfix
|
||||
NAME=Postfix
|
||||
TZ=
|
||||
unset TZ
|
||||
|
||||
test -x $DAEMON && test -f /etc/postfix/main.cf || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
#DISTRO=$(lsb_release -is 2>/dev/null || echo Debian)
|
||||
|
||||
enabled_instances() {
|
||||
postmulti -l -a | awk '($3=="y") { print $1}'
|
||||
}
|
||||
|
||||
running() {
|
||||
INSTANCE="$1"
|
||||
if [ "X$INSTANCE" = X ]; then
|
||||
POSTMULTI=""
|
||||
else
|
||||
POSTMULTI="postmulti -i $INSTANCE -x "
|
||||
fi
|
||||
POSTCONF="${POSTMULTI} postconf"
|
||||
|
||||
daemon_directory=$($POSTCONF -hx daemon_directory 2>/dev/null || echo /usr/lib/postfix/sbin)
|
||||
if ! ${POSTMULTI} $daemon_directory/master -t 2>/dev/null ; then
|
||||
echo y
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
RET=0
|
||||
# for all instances that are not already running, handle chroot setup if needed, and start
|
||||
for INSTANCE in $(enabled_instances); do
|
||||
RUNNING=$(running $INSTANCE)
|
||||
if [ "X$RUNNING" = X ]; then
|
||||
/usr/lib/postfix/configure-instance.sh $INSTANCE
|
||||
CMD="/usr/sbin/postmulti -- -i $INSTANCE -x ${DAEMON}"
|
||||
if ! start-stop-daemon --start --exec $CMD start; then
|
||||
RET=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
log_end_msg $RET
|
||||
;;
|
||||
|
||||
stop)
|
||||
RET=0
|
||||
# for all instances that are not already running, handle chroot setup if needed, and start
|
||||
for INSTANCE in $(enabled_instances); do
|
||||
RUNNING=$(running $INSTANCE)
|
||||
if [ "X$RUNNING" != X ]; then
|
||||
CMD="/usr/sbin/postmulti -i $INSTANCE -x ${DAEMON}"
|
||||
if ! ${CMD} stop; then
|
||||
RET=1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
log_end_msg $RET
|
||||
;;
|
||||
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
|
||||
force-reload|reload)
|
||||
${DAEMON} reload
|
||||
;;
|
||||
|
||||
status)
|
||||
ALL=1
|
||||
ANY=0
|
||||
# for all instances that are not already running, handle chroot setup if needed, and start
|
||||
for INSTANCE in $(enabled_instances); do
|
||||
RUNNING=$(running $INSTANCE)
|
||||
if [ "X$RUNNING" != X ]; then
|
||||
ANY=1
|
||||
else
|
||||
ALL=0
|
||||
fi
|
||||
done
|
||||
# handle the case when postmulti returns *no* configured instances
|
||||
if [ $ANY = 0 ]; then
|
||||
ALL=0
|
||||
fi
|
||||
if [ $ALL = 1 ]; then
|
||||
log_success_msg "postfix is running"
|
||||
exit 0
|
||||
elif [ $ANY = 1 ]; then
|
||||
log_success_msg "some postfix instances are running"
|
||||
exit 0
|
||||
else
|
||||
log_success_msg "postfix is not running"
|
||||
exit 3
|
||||
fi
|
||||
;;
|
||||
|
||||
flush|check|abort)
|
||||
${DAEMON} $1
|
||||
;;
|
||||
|
||||
*)
|
||||
log_action_msg "Usage: /etc/init.d/postfix {start|stop|restart|reload|flush|check|abort|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
35
etc/init.d/procps
Executable file
35
etc/init.d/procps
Executable file
@@ -0,0 +1,35 @@
|
||||
#! /bin/sh
|
||||
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
|
||||
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
|
||||
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
|
||||
fi
|
||||
### BEGIN INIT INFO
|
||||
# Provides: procps
|
||||
# Required-Start: mountkernfs $local_fs
|
||||
# Required-Stop:
|
||||
# Should-Start: udev module-init-tools
|
||||
# X-Start-Before: $network
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: Configure kernel parameters at boottime
|
||||
# Description: Loads kernel parameters that are specified in /etc/sysctl.conf
|
||||
### END INIT INFO
|
||||
#
|
||||
# written by Elrond <Elrond@Wunder-Nett.org>
|
||||
|
||||
DESC="Setting kernel variables"
|
||||
DAEMON=/sbin/sysctl
|
||||
PIDFILE=none
|
||||
|
||||
# Comment this out for sysctl to print every item changed
|
||||
QUIET_SYSCTL="-q"
|
||||
|
||||
do_start_cmd() {
|
||||
STATUS=0
|
||||
$DAEMON $QUIET_SYSCTL --system || STATUS=$?
|
||||
return $STATUS
|
||||
}
|
||||
|
||||
do_reload() { call do_start_cmd; }
|
||||
do_stop() { return 0; }
|
||||
do_status() { return 0; }
|
||||
156
etc/init.d/rsync
Executable file
156
etc/init.d/rsync
Executable file
@@ -0,0 +1,156 @@
|
||||
#! /bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: rsyncd
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Should-Start: $named autofs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop:
|
||||
# Short-Description: fast remote file copy program daemon
|
||||
# Description: rsync is a program that allows files to be copied to and
|
||||
# from remote machines in much the same way as rcp.
|
||||
# This provides rsyncd daemon functionality.
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
# /etc/init.d/rsync: start and stop the rsync daemon
|
||||
|
||||
DAEMON=/usr/bin/rsync
|
||||
RSYNC_ENABLE=false
|
||||
RSYNC_OPTS=''
|
||||
RSYNC_DEFAULTS_FILE=/etc/default/rsync
|
||||
RSYNC_CONFIG_FILE=/etc/rsyncd.conf
|
||||
RSYNC_PID_FILE=/var/run/rsync.pid
|
||||
RSYNC_NICE_PARM=''
|
||||
RSYNC_IONICE_PARM=''
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
if [ -s $RSYNC_DEFAULTS_FILE ]; then
|
||||
. $RSYNC_DEFAULTS_FILE
|
||||
case "x$RSYNC_ENABLE" in
|
||||
xtrue|xfalse) ;;
|
||||
xinetd) exit 0
|
||||
;;
|
||||
*) log_failure_msg "Value of RSYNC_ENABLE in $RSYNC_DEFAULTS_FILE must be either 'true' or 'false';"
|
||||
log_failure_msg "not starting rsync daemon."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
case "x$RSYNC_NICE" in
|
||||
x[0-9]|x1[0-9]) RSYNC_NICE_PARM="--nicelevel $RSYNC_NICE";;
|
||||
x) ;;
|
||||
*) log_warning_msg "Value of RSYNC_NICE in $RSYNC_DEFAULTS_FILE must be a value between 0 and 19 (inclusive);"
|
||||
log_warning_msg "ignoring RSYNC_NICE now."
|
||||
;;
|
||||
esac
|
||||
case "x$RSYNC_IONICE" in
|
||||
x-c[123]*) RSYNC_IONICE_PARM="$RSYNC_IONICE";;
|
||||
x) ;;
|
||||
*) log_warning_msg "Value of RSYNC_IONICE in $RSYNC_DEFAULTS_FILE must be -c1, -c2 or -c3;"
|
||||
log_warning_msg "ignoring RSYNC_IONICE now."
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
|
||||
|
||||
rsync_start() {
|
||||
if [ ! -s "$RSYNC_CONFIG_FILE" ]; then
|
||||
log_failure_msg "missing or empty config file $RSYNC_CONFIG_FILE"
|
||||
log_end_msg 1
|
||||
exit 0
|
||||
fi
|
||||
# See ionice(1)
|
||||
if [ -n "$RSYNC_IONICE_PARM" ] && [ -x /usr/bin/ionice ] &&
|
||||
/usr/bin/ionice "$RSYNC_IONICE_PARM" true 2>/dev/null; then
|
||||
/usr/bin/ionice "$RSYNC_IONICE_PARM" -p$$ > /dev/null 2>&1
|
||||
fi
|
||||
if start-stop-daemon --start --quiet --background \
|
||||
--pidfile $RSYNC_PID_FILE --make-pidfile \
|
||||
$RSYNC_NICE_PARM --exec $DAEMON \
|
||||
-- --no-detach --daemon --config "$RSYNC_CONFIG_FILE" $RSYNC_OPTS
|
||||
then
|
||||
rc=0
|
||||
sleep 1
|
||||
if ! kill -0 $(cat $RSYNC_PID_FILE) >/dev/null 2>&1; then
|
||||
log_failure_msg "rsync daemon failed to start"
|
||||
rc=1
|
||||
fi
|
||||
else
|
||||
rc=1
|
||||
fi
|
||||
if [ $rc -eq 0 ]; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
rm -f $RSYNC_PID_FILE
|
||||
fi
|
||||
} # rsync_start
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if "$RSYNC_ENABLE"; then
|
||||
log_daemon_msg "Starting rsync daemon" "rsync"
|
||||
if [ -s $RSYNC_PID_FILE ] && kill -0 $(cat $RSYNC_PID_FILE) >/dev/null 2>&1; then
|
||||
log_progress_msg "apparently already running"
|
||||
log_end_msg 0
|
||||
exit 0
|
||||
fi
|
||||
rsync_start
|
||||
else
|
||||
if [ -s "$RSYNC_CONFIG_FILE" ]; then
|
||||
[ "$VERBOSE" != no ] && log_warning_msg "rsync daemon not enabled in $RSYNC_DEFAULTS_FILE, not starting..."
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping rsync daemon" "rsync"
|
||||
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $RSYNC_PID_FILE
|
||||
RETVAL="$?"
|
||||
log_end_msg $RETVAL
|
||||
if [ $RETVAL != 0 ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
rm -f $RSYNC_PID_FILE
|
||||
;;
|
||||
|
||||
reload|force-reload)
|
||||
log_warning_msg "Reloading rsync daemon: not needed, as the daemon"
|
||||
log_warning_msg "re-reads the config file whenever a client connects."
|
||||
;;
|
||||
|
||||
restart)
|
||||
set +e
|
||||
if $RSYNC_ENABLE; then
|
||||
log_daemon_msg "Restarting rsync daemon" "rsync"
|
||||
if [ -s $RSYNC_PID_FILE ] && kill -0 $(cat $RSYNC_PID_FILE) >/dev/null 2>&1; then
|
||||
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $RSYNC_PID_FILE
|
||||
else
|
||||
log_warning_msg "rsync daemon not running, attempting to start."
|
||||
rm -f $RSYNC_PID_FILE
|
||||
fi
|
||||
rsync_start
|
||||
else
|
||||
if [ -s "$RSYNC_CONFIG_FILE" ]; then
|
||||
[ "$VERBOSE" != no ] && log_warning_msg "rsync daemon not enabled in $RSYNC_DEFAULTS_FILE, not starting..."
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc -p $RSYNC_PID_FILE "$DAEMON" rsync
|
||||
exit $? # notreached due to set -e
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/rsync {start|stop|reload|force-reload|restart|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
||||
49
etc/init.d/screen-cleanup
Executable file
49
etc/init.d/screen-cleanup
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
# $Id: init,v 1.3 2004/03/16 01:43:45 zal Exp $
|
||||
#
|
||||
# Script to remove stale screen named pipes on bootup.
|
||||
#
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: screen-cleanup
|
||||
# Required-Start: $remote_fs
|
||||
# Required-Stop: $remote_fs
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: screen sessions cleaning
|
||||
# Description: Cleans up the screen session directory and fixes its
|
||||
# permissions if needed.
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
test -f /usr/bin/screen || exit 0
|
||||
|
||||
SCREENDIR=/run/screen
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if test -L $SCREENDIR || ! test -d $SCREENDIR; then
|
||||
rm -f $SCREENDIR
|
||||
mkdir $SCREENDIR
|
||||
chown root:utmp $SCREENDIR
|
||||
[ -x /sbin/restorecon ] && /sbin/restorecon $SCREENDIR
|
||||
fi
|
||||
find $SCREENDIR -type p -delete
|
||||
# If the local admin has used dpkg-statoverride to install the screen
|
||||
# binary with different set[ug]id bits, change the permissions of
|
||||
# $SCREENDIR accordingly
|
||||
BINARYPERM=`stat -c%a /usr/bin/screen`
|
||||
if [ "$BINARYPERM" -ge 4000 ]; then
|
||||
chmod 0755 $SCREENDIR
|
||||
elif [ "$BINARYPERM" -ge 2000 ]; then
|
||||
chmod 0775 $SCREENDIR
|
||||
else
|
||||
chmod 1777 $SCREENDIR
|
||||
fi
|
||||
;;
|
||||
stop|restart|reload|force-reload)
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
94
etc/init.d/spamd
Executable file
94
etc/init.d/spamd
Executable file
@@ -0,0 +1,94 @@
|
||||
#! /bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: spamassassin
|
||||
# Required-Start: $remote_fs
|
||||
# Required-Stop: $remote_fs
|
||||
# Should-Start: $network $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
### END INIT INFO
|
||||
|
||||
# Spamd init script
|
||||
# June 2002
|
||||
# Duncan Findlay
|
||||
|
||||
# Based on skeleton by Miquel van Smoorenburg and Ian Murdock
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
DAEMON=/usr/sbin/spamd
|
||||
NAME=spamd
|
||||
SNAME=spamassassin
|
||||
DESC="SpamAssassin Mail Filter Daemon"
|
||||
PIDFILE="/run/$NAME.pid"
|
||||
|
||||
export TMPDIR=/tmp
|
||||
# Apparently people have trouble if this isn't explicitly set...
|
||||
|
||||
# Defaults - don't touch, edit /etc/default/spamassassin
|
||||
OPTIONS=""
|
||||
NICE=
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
test -f /etc/default/spamd && . /etc/default/spamd
|
||||
|
||||
DOPTIONS="-d --pidfile=$PIDFILE"
|
||||
|
||||
# Note: check_enabled should go away as soon as possible after the
|
||||
# next stable release to complete the transition away from using
|
||||
# ENABLED=1 in /etc/default/spamassassin
|
||||
check_enabled() {
|
||||
if [ "$ENABLED" = "0" ]; then
|
||||
echo "$DESC: disabled, see /etc/default/spamassassin"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
test -f $DAEMON || exit 0
|
||||
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
check_enabled
|
||||
echo -n "Starting $DESC: "
|
||||
start-stop-daemon --start --pidfile $PIDFILE --name $NAME \
|
||||
$NICE --oknodo --startas $DAEMON -- $OPTIONS $DOPTIONS
|
||||
echo "$NAME."
|
||||
;;
|
||||
|
||||
stop)
|
||||
echo -n "Stopping $DESC: "
|
||||
start-stop-daemon --stop --pidfile $PIDFILE --name $NAME --oknodo
|
||||
echo "$NAME."
|
||||
;;
|
||||
|
||||
reload|force-reload)
|
||||
check_enabled
|
||||
echo -n "Reloading $DESC: "
|
||||
start-stop-daemon --stop --pidfile $PIDFILE --signal HUP --name $NAME
|
||||
echo "$NAME."
|
||||
;;
|
||||
|
||||
restart)
|
||||
check_enabled
|
||||
echo -n "Restarting $DESC: "
|
||||
start-stop-daemon --stop --pidfile $PIDFILE --name $NAME \
|
||||
--retry 5 --oknodo
|
||||
start-stop-daemon --start --pidfile $PIDFILE --name $NAME \
|
||||
$NICE --oknodo --startas $DAEMON -- $OPTIONS $DOPTIONS
|
||||
|
||||
echo "$NAME."
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
|
||||
;;
|
||||
*)
|
||||
N=/etc/init.d/$SNAME
|
||||
echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
166
etc/init.d/ssh
Executable file
166
etc/init.d/ssh
Executable file
@@ -0,0 +1,166 @@
|
||||
#! /bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: ssh sshd
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop:
|
||||
# Short-Description: OpenBSD Secure Shell server
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
# /etc/init.d/ssh: start and stop the OpenBSD "secure shell(tm)" daemon
|
||||
|
||||
test -x /usr/sbin/sshd || exit 0
|
||||
( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0
|
||||
|
||||
umask 022
|
||||
|
||||
if test -f /etc/default/ssh; then
|
||||
. /etc/default/ssh
|
||||
fi
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
SSHD_OPTS="$SSHD_OPTS $2"
|
||||
fi
|
||||
|
||||
# Are we running from init?
|
||||
run_by_init() {
|
||||
([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
|
||||
}
|
||||
|
||||
check_for_no_start() {
|
||||
# forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
|
||||
if [ -e /etc/ssh/sshd_not_to_be_run ]; then
|
||||
if [ "$1" = log_end_msg ]; then
|
||||
log_end_msg 0 || true
|
||||
fi
|
||||
if ! run_by_init; then
|
||||
log_action_msg "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)" || true
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
check_dev_null() {
|
||||
if [ ! -c /dev/null ]; then
|
||||
if [ "$1" = log_end_msg ]; then
|
||||
log_end_msg 1 || true
|
||||
fi
|
||||
if ! run_by_init; then
|
||||
log_action_msg "/dev/null is not a character device!" || true
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_privsep_dir() {
|
||||
# Create the PrivSep empty dir if necessary
|
||||
if [ ! -d /run/sshd ]; then
|
||||
mkdir /run/sshd
|
||||
chmod 0755 /run/sshd
|
||||
fi
|
||||
}
|
||||
|
||||
check_config() {
|
||||
if [ ! -e /etc/ssh/sshd_not_to_be_run ]; then
|
||||
# shellcheck disable=SC2086
|
||||
/usr/sbin/sshd $SSHD_OPTS -t || exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
check_privsep_dir
|
||||
check_for_no_start
|
||||
check_dev_null
|
||||
log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd" || true
|
||||
# shellcheck disable=SC2086
|
||||
if start-stop-daemon --start --quiet --oknodo --chuid 0:0 --pidfile /run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
|
||||
log_end_msg 0 || true
|
||||
else
|
||||
log_end_msg 1 || true
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping OpenBSD Secure Shell server" "sshd" || true
|
||||
if start-stop-daemon --stop --quiet --oknodo --pidfile /run/sshd.pid --exec /usr/sbin/sshd; then
|
||||
log_end_msg 0 || true
|
||||
else
|
||||
log_end_msg 1 || true
|
||||
fi
|
||||
;;
|
||||
|
||||
reload|force-reload)
|
||||
check_for_no_start
|
||||
check_config
|
||||
log_daemon_msg "Reloading OpenBSD Secure Shell server's configuration" "sshd" || true
|
||||
if start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /run/sshd.pid --exec /usr/sbin/sshd; then
|
||||
log_end_msg 0 || true
|
||||
else
|
||||
log_end_msg 1 || true
|
||||
fi
|
||||
;;
|
||||
|
||||
restart)
|
||||
check_privsep_dir
|
||||
check_config
|
||||
log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true
|
||||
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /run/sshd.pid --exec /usr/sbin/sshd
|
||||
check_for_no_start log_end_msg
|
||||
check_dev_null log_end_msg
|
||||
# shellcheck disable=SC2086
|
||||
if start-stop-daemon --start --quiet --oknodo --chuid 0:0 --pidfile /run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
|
||||
log_end_msg 0 || true
|
||||
else
|
||||
log_end_msg 1 || true
|
||||
fi
|
||||
;;
|
||||
|
||||
try-restart)
|
||||
check_privsep_dir
|
||||
check_config
|
||||
log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true
|
||||
RET=0
|
||||
start-stop-daemon --stop --quiet --retry 30 --pidfile /run/sshd.pid --exec /usr/sbin/sshd || RET="$?"
|
||||
case $RET in
|
||||
0)
|
||||
# old daemon stopped
|
||||
check_for_no_start log_end_msg
|
||||
check_dev_null log_end_msg
|
||||
# shellcheck disable=SC2086
|
||||
if start-stop-daemon --start --quiet --oknodo --chuid 0:0 --pidfile /run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
|
||||
log_end_msg 0 || true
|
||||
else
|
||||
log_end_msg 1 || true
|
||||
fi
|
||||
;;
|
||||
1)
|
||||
# daemon not running
|
||||
log_progress_msg "(not running)" || true
|
||||
log_end_msg 0 || true
|
||||
;;
|
||||
*)
|
||||
# failed to stop
|
||||
log_progress_msg "(failed to stop)" || true
|
||||
log_end_msg 1 || true
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc -p /run/sshd.pid /usr/sbin/sshd sshd && exit 0 || exit $?
|
||||
;;
|
||||
|
||||
*)
|
||||
log_action_msg "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart|try-restart|status}" || true
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
||||
62
etc/init.d/sysstat
Executable file
62
etc/init.d/sysstat
Executable file
@@ -0,0 +1,62 @@
|
||||
#! /bin/sh
|
||||
# vim:ft=sh:et
|
||||
### BEGIN INIT INFO
|
||||
# Provides: sysstat
|
||||
# Required-Start: $remote_fs $local_fs $syslog
|
||||
# Required-Stop:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop:
|
||||
# Short-Description: Start/stop sysstat's sadc
|
||||
# Description: Sysstat contains system performance tools for Linux
|
||||
# The init file runs the sadc command in order to write
|
||||
# the "LINUX RESTART" mark to the daily data file
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
DAEMON=/usr/lib/sysstat/debian-sa1
|
||||
NAME=sadc
|
||||
DESC="the system activity data collector"
|
||||
|
||||
test -f "$DAEMON" || exit 0
|
||||
umask 022
|
||||
|
||||
# our configuration file
|
||||
DEFAULT=/etc/default/sysstat
|
||||
|
||||
# default setting...
|
||||
ENABLED="false"
|
||||
|
||||
# ...overridden in the configuration file
|
||||
test -r "$DEFAULT" && . "$DEFAULT"
|
||||
|
||||
set -e
|
||||
status=0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
case "$1" in
|
||||
start|restart|reload|force-reload)
|
||||
if [ "$ENABLED" = "true" ] ; then
|
||||
log_daemon_msg "Starting $DESC" "$NAME"
|
||||
start-stop-daemon --start --quiet --exec $DAEMON -- --boot || status=$?
|
||||
log_end_msg $status
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
status)
|
||||
if [ "$ENABLED" = "true" ] ; then
|
||||
log_success_msg "sadc cron jobs are enabled"
|
||||
exit 0
|
||||
else
|
||||
log_failure_msg "sadc cron jobs are disabled"
|
||||
exit 3
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
log_failure_msg "Usage: $0 {start|stop|restart|reload|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $status
|
||||
86
etc/init.d/ufw
Executable file
86
etc/init.d/ufw
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: ufw
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: S
|
||||
# Default-Stop: 1
|
||||
# Short-Description: start firewall
|
||||
# Description: Start ufw firewall
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
PATH="/sbin:/bin"
|
||||
|
||||
[ -d /usr/lib/ufw ] || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
for s in "/usr/lib/ufw/ufw-init-functions" "/etc/ufw/ufw.conf" "/etc/default/ufw" ; do
|
||||
if [ -s "$s" ]; then
|
||||
. "$s"
|
||||
else
|
||||
log_failure_msg "Could not find $s (aborting)"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
error=0
|
||||
case "$1" in
|
||||
start)
|
||||
if [ "$ENABLED" = "yes" ] || [ "$ENABLED" = "YES" ]; then
|
||||
log_action_begin_msg "Starting firewall:" "ufw"
|
||||
output=`ufw_start` || error="$?"
|
||||
if [ "$error" = "0" ]; then
|
||||
log_action_cont_msg "Setting kernel variables ($IPT_SYSCTL)"
|
||||
fi
|
||||
if [ ! -z "$output" ]; then
|
||||
echo "$output" | while read line ; do
|
||||
log_action_cont_msg "$line"
|
||||
done
|
||||
fi
|
||||
else
|
||||
log_action_begin_msg "Skip starting firewall:" "ufw (not enabled)"
|
||||
fi
|
||||
log_action_end_msg $error
|
||||
exit $error
|
||||
;;
|
||||
stop)
|
||||
if [ "$ENABLED" = "yes" ] || [ "$ENABLED" = "YES" ]; then
|
||||
log_action_begin_msg "Stopping firewall:" "ufw"
|
||||
output=`ufw_stop` || error="$?"
|
||||
if [ ! -z "$output" ]; then
|
||||
log_action_cont_msg "$output"
|
||||
fi
|
||||
else
|
||||
log_action_begin_msg "Skip stopping firewall:" "ufw (not enabled)"
|
||||
fi
|
||||
log_action_end_msg $error
|
||||
exit $error
|
||||
;;
|
||||
restart|force-reload)
|
||||
log_action_begin_msg "Reloading firewall:" "ufw"
|
||||
output=`ufw_reload` || error="$?"
|
||||
if [ ! -z "$output" ]; then
|
||||
log_action_cont_msg "$output"
|
||||
fi
|
||||
log_action_end_msg $error
|
||||
exit $error
|
||||
;;
|
||||
status)
|
||||
output=`ufw_status` || error="$?"
|
||||
if [ ! -z "$output" ]; then
|
||||
log_action_cont_msg "$output"
|
||||
fi
|
||||
log_action_end_msg $error
|
||||
exit $error
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/ufw {start|stop|restart|force-reload|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
51
etc/init.d/unattended-upgrades
Executable file
51
etc/init.d/unattended-upgrades
Executable file
@@ -0,0 +1,51 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Required-Start: $local_fs $remote_fs
|
||||
# Required-Stop: $local_fs $remote_fs
|
||||
# Provides: unattended-upgrade-shutdown-check
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Check if unattended upgrades are being applied
|
||||
# Description: Check if unattended upgrades are being applied
|
||||
# and wait for them to finish
|
||||
### END INIT INFO
|
||||
set -e
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
|
||||
NAME="unattended-upgrades-shutdown"
|
||||
DESC="unattended package upgrades shutdown"
|
||||
SCRIPTNAME="/etc/init.d/$NAME"
|
||||
SHUTDOWN_HELPER="/usr/share/unattended-upgrades/unattended-upgrade-shutdown"
|
||||
|
||||
if [ -x /usr/bin/python3 ]; then
|
||||
PYTHON=python3
|
||||
else
|
||||
PYTHON=python
|
||||
fi
|
||||
|
||||
# Load the VERBOSE setting and other rcS variables
|
||||
. /lib/init/vars.sh
|
||||
|
||||
# Define LSB log_* functions.
|
||||
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
case "$1" in
|
||||
start|restart|force-reload|status)
|
||||
# nothing, just to keep update-rc.d happy (see debian #630732)
|
||||
;;
|
||||
stop)
|
||||
if [ -e $SHUTDOWN_HELPER ]; then
|
||||
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Checking for running $DESC"
|
||||
$PYTHON $SHUTDOWN_HELPER
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg $? "$NAME"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
:
|
||||
62
etc/init.d/uuidd
Executable file
62
etc/init.d/uuidd
Executable file
@@ -0,0 +1,62 @@
|
||||
#! /bin/sh -e
|
||||
### BEGIN INIT INFO
|
||||
# Provides: uuidd
|
||||
# Required-Start: $time $local_fs $remote_fs
|
||||
# Required-Stop: $time $local_fs $remote_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: uuidd daemon
|
||||
# Description: Init script for the uuid generation daemon
|
||||
### END INIT INFO
|
||||
#
|
||||
# Author: "Theodore Ts'o" <tytso@mit.edu>
|
||||
#
|
||||
set -e
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
DAEMON=/usr/sbin/uuidd
|
||||
UUIDD_USER=uuidd
|
||||
UUIDD_GROUP=uuidd
|
||||
UUIDD_DIR=/run/uuidd
|
||||
PIDFILE=$UUIDD_DIR/uuidd.pid
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_daemon_msg "Starting uuid generator" "uuidd"
|
||||
if ! test -d $UUIDD_DIR; then
|
||||
mkdir -p $UUIDD_DIR
|
||||
chown -R $UUIDD_USER:$UUIDD_GROUP $UUIDD_DIR
|
||||
fi
|
||||
start_daemon -p $PIDFILE $DAEMON
|
||||
log_end_msg $?
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping uuid generator" "uuidd"
|
||||
killproc -p $PIDFILE $DAEMON
|
||||
log_end_msg $?
|
||||
;;
|
||||
status)
|
||||
if pidofproc -p $PIDFILE $DAEMON >/dev/null 2>&1; then
|
||||
echo "$DAEMON is running";
|
||||
exit 0;
|
||||
else
|
||||
echo "$DAEMON is NOT running";
|
||||
if test -f $PIDFILE; then exit 2; fi
|
||||
exit 3;
|
||||
fi
|
||||
;;
|
||||
force-reload|restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/uuidd {start|stop|restart|force-reload}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
122
etc/init.d/x11-common
Executable file
122
etc/init.d/x11-common
Executable file
@@ -0,0 +1,122 @@
|
||||
#!/bin/sh
|
||||
# /etc/init.d/x11-common: set up the X server and ICE socket directories
|
||||
### BEGIN INIT INFO
|
||||
# Provides: x11-common
|
||||
# Required-Start: $remote_fs
|
||||
# Required-Stop: $remote_fs
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: set up the X server and ICE socket directories
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
PATH=/usr/bin:/usr/sbin:/bin:/sbin
|
||||
SOCKET_DIR=.X11-unix
|
||||
ICE_DIR=.ICE-unix
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
if [ -f /etc/default/rcS ]; then
|
||||
. /etc/default/rcS
|
||||
fi
|
||||
|
||||
do_restorecon () {
|
||||
# Restore file security context (SELinux).
|
||||
if command -v restorecon >/dev/null 2>&1; then
|
||||
restorecon "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# create a directory in /tmp.
|
||||
# assumes /tmp has a sticky bit set (or is only writeable by root)
|
||||
set_up_dir () {
|
||||
DIR="/tmp/$1"
|
||||
|
||||
if [ "$VERBOSE" != no ]; then
|
||||
log_progress_msg "$DIR"
|
||||
fi
|
||||
# if $DIR exists and isn't a directory, move it aside
|
||||
if [ -e $DIR ] && ! [ -d $DIR ] || [ -h $DIR ]; then
|
||||
mv "$DIR" "$(mktemp -d $DIR.XXXXXX)"
|
||||
fi
|
||||
|
||||
error=0
|
||||
while :; do
|
||||
if [ $error -ne 0 ] ; then
|
||||
# an error means the file-system is readonly or an attacker
|
||||
# is doing evil things, distinguish by creating a temporary file,
|
||||
# but give up after a while.
|
||||
if [ $error -gt 5 ]; then
|
||||
log_failure_msg "failed to set up $DIR"
|
||||
return 1
|
||||
fi
|
||||
fn="$(mktemp /tmp/testwriteable.XXXXXXXXXX)" || return 1
|
||||
rm "$fn"
|
||||
fi
|
||||
mkdir -p -m 01777 "$DIR" || { rm "$DIR" || error=$((error + 1)) ; continue ; }
|
||||
case "$(LC_ALL=C stat -c '%u %g %a %F' "$DIR")" in
|
||||
"0 0 1777 directory")
|
||||
# everything as it is supposed to be
|
||||
break
|
||||
;;
|
||||
"0 0 "*" directory")
|
||||
# as it is owned by root, cannot be replaced with a symlink:
|
||||
chmod 01777 "$DIR"
|
||||
break
|
||||
;;
|
||||
*" directory")
|
||||
# if the chown succeeds, the next step can change it savely
|
||||
chown -h root:root "$DIR" || error=$((error + 1))
|
||||
continue
|
||||
;;
|
||||
*)
|
||||
log_failure_msg "failed to set up $DIR"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
do_restorecon "$DIR"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
do_status () {
|
||||
if [ -d "/tmp/$ICE_DIR" ] && [ -d "/tmp/$SOCKET_DIR" ]; then
|
||||
return 0
|
||||
else
|
||||
return 4
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ "$VERBOSE" != no ]; then
|
||||
log_begin_msg "Setting up X socket directories..."
|
||||
fi
|
||||
set_up_dir "$SOCKET_DIR"
|
||||
set_up_dir "$ICE_DIR"
|
||||
if [ "$VERBOSE" != no ]; then
|
||||
log_end_msg 0
|
||||
fi
|
||||
;;
|
||||
|
||||
restart|reload|force-reload)
|
||||
/etc/init.d/x11-common start
|
||||
;;
|
||||
|
||||
stop)
|
||||
:
|
||||
;;
|
||||
|
||||
status)
|
||||
do_status
|
||||
;;
|
||||
*)
|
||||
log_success_msg "Usage: /etc/init.d/x11-common {start|stop|status|restart|reload|force-reload}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# vim:set ai et sts=2 sw=2 tw=0:
|
||||
84
etc/init.d/xinetd
Executable file
84
etc/init.d/xinetd
Executable file
@@ -0,0 +1,84 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: xinetd inetd
|
||||
# Required-Start: $local_fs $remote_fs $network
|
||||
# Required-Stop: $local_fs $remote_fs $network
|
||||
# Should-Start: $syslog
|
||||
# Should-Stop: $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Starts or stops the xinetd daemon.
|
||||
# Description: Starts and stops xinetd, an inetd replacement
|
||||
### END INIT INFO
|
||||
|
||||
# clear poisonned environment
|
||||
unset TMPDIR
|
||||
|
||||
NAME=xinetd
|
||||
DAEMON=/usr/sbin/$NAME
|
||||
PIDFILE=/run/$NAME.pid
|
||||
|
||||
test -x "$DAEMON" || exit 0
|
||||
|
||||
test -e /etc/default/$NAME && . /etc/default/$NAME
|
||||
case "$INETD_COMPAT" in
|
||||
[Yy]*)
|
||||
XINETD_OPTS="$XINETD_OPTS -inetd_compat"
|
||||
if perl -MSocket -e 'exit (!socket($sock, AF_INET6, SOCK_STREAM, 0))'; then
|
||||
XINETD_OPTS="$XINETD_OPTS -inetd_ipv6"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
checkportmap () {
|
||||
if grep "^[^ *#]" /etc/xinetd.conf | grep -q 'rpc/'; then
|
||||
if ! rpcinfo -u localhost portmapper >/dev/null 2>&1; then
|
||||
echo
|
||||
echo "WARNING: portmapper inactive - RPC services unavailable!"
|
||||
echo " Commenting out or removing the RPC services from"
|
||||
echo " the /etc/xinetd.conf file will remove this message."
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
checkportmap
|
||||
log_daemon_msg "Starting internet superserver" "$NAME"
|
||||
start-stop-daemon --pidfile "$PIDFILE" --start --quiet --background --exec "$DAEMON" -- \
|
||||
-pidfile "$PIDFILE" $XINETD_OPTS
|
||||
log_end_msg $?
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping internet superserver" "$NAME"
|
||||
start-stop-daemon --pidfile "$PIDFILE" --stop --signal 3 --quiet --oknodo --exec "$DAEMON"
|
||||
log_end_msg $?
|
||||
;;
|
||||
reload)
|
||||
log_daemon_msg "Reloading internet superserver configuration" "$NAME"
|
||||
start-stop-daemon --pidfile "$PIDFILE" --stop --signal 1 --quiet --oknodo --exec "$DAEMON"
|
||||
log_end_msg $?
|
||||
;;
|
||||
restart|force-reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p "$PIDFILE" "$DAEMON"
|
||||
R=$?
|
||||
if test "$R" = "0" ; then
|
||||
kill -10 $(cat "$PIDFILE")
|
||||
cat /var/run/xinetd.dump
|
||||
fi
|
||||
exit $R
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/xinetd {start|stop|reload|force-reload|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user