etc and var customers
This commit is contained in:
104
etc/init.d/avahi-daemon
Executable file
104
etc/init.d/avahi-daemon
Executable file
@@ -0,0 +1,104 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: avahi avahi-daemon
|
||||
# Required-Start: $remote_fs dbus
|
||||
# Required-Stop: $remote_fs dbus
|
||||
# Should-Start: $syslog
|
||||
# Should-Stop: $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Avahi mDNS/DNS-SD Daemon
|
||||
# Description: Zeroconf daemon for configuring your network
|
||||
# automatically
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
DESC="Avahi mDNS/DNS-SD Daemon"
|
||||
NAME="avahi-daemon"
|
||||
DAEMON="/usr/sbin/$NAME"
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
# Gracefully exit if the package has been removed.
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# Include avahi-daemon defaults if available.
|
||||
test -f /etc/default/avahi-daemon && . /etc/default/avahi-daemon
|
||||
|
||||
DISABLE_TAG="/var/run/avahi-daemon/disabled-for-unicast-local"
|
||||
|
||||
#
|
||||
# Function that starts the daemon/service.
|
||||
#
|
||||
d_start() {
|
||||
$DAEMON -c && return 0
|
||||
|
||||
if [ -e $DISABLE_TAG -a "$AVAHI_DAEMON_DETECT_LOCAL" != "0" ]; then
|
||||
# Disabled because of the existance of an unicast .local domain
|
||||
log_warning_msg "avahi-daemon disabled because there is a unicast .local domain"
|
||||
exit 0;
|
||||
fi;
|
||||
|
||||
$DAEMON -D
|
||||
}
|
||||
|
||||
#
|
||||
# Function that stops the daemon/service.
|
||||
#
|
||||
d_stop() {
|
||||
if $DAEMON -c ; then
|
||||
$DAEMON -k
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Function that reload the config file for the daemon/service.
|
||||
#
|
||||
d_reload() {
|
||||
$DAEMON -c && $DAEMON -r
|
||||
}
|
||||
|
||||
#
|
||||
# Function that check the status of the daemon/service.
|
||||
#
|
||||
d_status() {
|
||||
$DAEMON -c && { echo "$DESC is running"; exit 0; } || { echo "$DESC is not running"; exit 3; }
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_daemon_msg "Starting $DESC" "$NAME"
|
||||
d_start
|
||||
log_end_msg $?
|
||||
;;
|
||||
stop)
|
||||
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
d_stop
|
||||
log_end_msg $?
|
||||
;;
|
||||
reload|force-reload)
|
||||
log_daemon_msg "Reloading services for $DESC" "$NAME"
|
||||
d_reload
|
||||
log_end_msg $?
|
||||
;;
|
||||
restart)
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
d_stop
|
||||
if [ "$?" -eq 0 ]; then
|
||||
d_start
|
||||
log_end_msg $?
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
d_status
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload|status}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
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/timezone ]; then
|
||||
TZ=`cat /etc/timezone`
|
||||
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 $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
|
||||
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
|
||||
|
||||
120
etc/init.d/hwclock.sh
Executable file
120
etc/init.d/hwclock.sh
Executable file
@@ -0,0 +1,120 @@
|
||||
#!/bin/sh
|
||||
# hwclock.sh Set and adjust the CMOS clock.
|
||||
#
|
||||
# Version: @(#)hwclock.sh 2.00 14-Dec-1998 miquels@cistron.nl
|
||||
#
|
||||
# Patches:
|
||||
# 2000-01-30 Henrique M. Holschuh <hmh@rcm.org.br>
|
||||
# - Minor cosmetic changes in an attempt to help new
|
||||
# users notice something IS changing their clocks
|
||||
# during startup/shutdown.
|
||||
# - Added comments to alert users of hwclock issues
|
||||
# and discourage tampering without proper doc reading.
|
||||
# 2012-02-16 Roger Leigh <rleigh@debian.org>
|
||||
# - Use the UTC/LOCAL setting in /etc/adjtime rather than
|
||||
# the UTC setting in /etc/default/rcS. Additionally
|
||||
# source /etc/default/hwclock to permit configuration.
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: hwclock
|
||||
# Required-Start: mountdevsubfs
|
||||
# Required-Stop: mountdevsubfs
|
||||
# Should-Stop: umountfs
|
||||
# Default-Start: S
|
||||
# X-Start-Before: checkroot
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Sync hardware and system clock time.
|
||||
### END INIT INFO
|
||||
|
||||
# These defaults are user-overridable in /etc/default/hwclock
|
||||
BADYEAR=no
|
||||
HWCLOCKACCESS=yes
|
||||
HWCLOCKPARS=
|
||||
HCTOSYS_DEVICE=rtc0
|
||||
|
||||
# We only want to use the system timezone or else we'll get
|
||||
# potential inconsistency at startup.
|
||||
unset TZ
|
||||
|
||||
hwclocksh()
|
||||
{
|
||||
[ ! -x /sbin/hwclock ] && return 0
|
||||
[ ! -r /etc/default/rcS ] || . /etc/default/rcS
|
||||
[ ! -r /etc/default/hwclock ] || . /etc/default/hwclock
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
verbose_log_action_msg() { [ "$VERBOSE" = no ] || log_action_msg "$@"; }
|
||||
|
||||
case "$BADYEAR" in
|
||||
no|"") BADYEAR="" ;;
|
||||
yes) BADYEAR="--badyear" ;;
|
||||
*) log_action_msg "unknown BADYEAR setting: \"$BADYEAR\""; return 1 ;;
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
# If the admin deleted the hwclock config, create a blank
|
||||
# template with the defaults.
|
||||
if [ -w /etc ] && [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; then
|
||||
printf "0.0 0 0.0\n0\nUTC\n" > /etc/adjtime
|
||||
fi
|
||||
|
||||
if [ -d /run/udev ] || [ -d /dev/.udev ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$HWCLOCKACCESS" != no ]; then
|
||||
log_action_msg "Setting the system clock"
|
||||
|
||||
# Just for reporting.
|
||||
if sed '3!d' /etc/adjtime | grep -q '^UTC$'; then
|
||||
UTC="--utc"
|
||||
else
|
||||
UTC=
|
||||
fi
|
||||
# Copies Hardware Clock time to System Clock using the correct
|
||||
# timezone for hardware clocks in local time, and sets kernel
|
||||
# timezone. DO NOT REMOVE.
|
||||
if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --hctosys $HWCLOCKPARS $BADYEAR; then
|
||||
# Announce the local time.
|
||||
verbose_log_action_msg "System Clock set to: `date $UTC`"
|
||||
else
|
||||
log_warning_msg "Unable to set System Clock to: `date $UTC`"
|
||||
fi
|
||||
else
|
||||
verbose_log_action_msg "Not setting System Clock"
|
||||
fi
|
||||
;;
|
||||
stop|restart|reload|force-reload)
|
||||
#
|
||||
# Updates the Hardware Clock with the System Clock time.
|
||||
# This will *override* any changes made to the Hardware Clock.
|
||||
#
|
||||
# WARNING: If you disable this, any changes to the system
|
||||
# clock will not be carried across reboots.
|
||||
#
|
||||
|
||||
if [ "$HWCLOCKACCESS" != no ]; then
|
||||
log_action_msg "Saving the system clock"
|
||||
if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --systohc $HWCLOCKPARS $BADYEAR; then
|
||||
verbose_log_action_msg "Hardware Clock updated to `date`"
|
||||
fi
|
||||
else
|
||||
verbose_log_action_msg "Not saving System Clock"
|
||||
fi
|
||||
;;
|
||||
show)
|
||||
if [ "$HWCLOCKACCESS" != no ]; then
|
||||
/sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --show $HWCLOCKPARS $BADYEAR
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
log_success_msg "Usage: hwclock.sh {start|stop|reload|force-reload|show}"
|
||||
log_success_msg " start sets kernel (system) clock from hardware (RTC) clock"
|
||||
log_success_msg " stop and reload set hardware (RTC) clock from kernel (system) clock"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
hwclocksh "$@"
|
||||
177
etc/init.d/nginx
Executable file
177
etc/init.d/nginx
Executable file
@@ -0,0 +1,177 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: nginx
|
||||
# Required-Start: $network $remote_fs $local_fs
|
||||
# Required-Stop: $network $remote_fs $local_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Stop/start nginx
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Sergey Budnevitch <sb@nginx.com>
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
|
||||
if [ -L $0 ]; then
|
||||
SCRIPTNAME=`/bin/readlink -f $0`
|
||||
else
|
||||
SCRIPTNAME=$0
|
||||
fi
|
||||
|
||||
sysconfig=`/usr/bin/basename $SCRIPTNAME`
|
||||
|
||||
[ -r /etc/default/$sysconfig ] && . /etc/default/$sysconfig
|
||||
|
||||
DESC=${DESC:-nginx}
|
||||
NAME=${NAME:-nginx}
|
||||
CONFFILE=${CONFFILE:-/etc/nginx/nginx.conf}
|
||||
DAEMON=${DAEMON:-/usr/sbin/nginx}
|
||||
PIDFILE=${PIDFILE:-/var/run/nginx.pid}
|
||||
SLEEPSEC=${SLEEPSEC:-1}
|
||||
UPGRADEWAITLOOPS=${UPGRADEWAITLOOPS:-5}
|
||||
CHECKSLEEP=${CHECKSLEEP:-3}
|
||||
|
||||
[ -x $DAEMON ] || exit 0
|
||||
|
||||
DAEMON_ARGS="-c $CONFFILE $DAEMON_ARGS"
|
||||
|
||||
. /lib/init/vars.sh
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
do_start()
|
||||
{
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
||||
$DAEMON_ARGS
|
||||
RETVAL="$?"
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
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 --oknodo --retry=TERM/30/KILL/5 --pidfile $PIDFILE
|
||||
RETVAL="$?"
|
||||
rm -f $PIDFILE
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
do_reload() {
|
||||
#
|
||||
start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE
|
||||
RETVAL="$?"
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
do_configtest() {
|
||||
if [ "$#" -ne 0 ]; then
|
||||
case "$1" in
|
||||
-q)
|
||||
FLAG=$1
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
fi
|
||||
$DAEMON -t $FLAG -c $CONFFILE
|
||||
RETVAL="$?"
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
do_upgrade() {
|
||||
OLDBINPIDFILE=$PIDFILE.oldbin
|
||||
|
||||
do_configtest -q || return 6
|
||||
start-stop-daemon --stop --signal USR2 --quiet --pidfile $PIDFILE
|
||||
RETVAL="$?"
|
||||
|
||||
for i in `/usr/bin/seq $UPGRADEWAITLOOPS`; do
|
||||
sleep $SLEEPSEC
|
||||
if [ -f $OLDBINPIDFILE -a -f $PIDFILE ]; then
|
||||
start-stop-daemon --stop --signal QUIT --quiet --pidfile $OLDBINPIDFILE
|
||||
RETVAL="$?"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
echo $"Upgrade failed!"
|
||||
RETVAL=1
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
do_checkreload() {
|
||||
templog=`/bin/mktemp --tmpdir nginx-check-reload-XXXXXX.log`
|
||||
trap '/bin/rm -f $templog' 0
|
||||
/usr/bin/tail --pid=$$ -n 0 --follow=name /var/log/nginx/error.log > $templog &
|
||||
/bin/sleep 1
|
||||
start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE
|
||||
/bin/sleep $CHECKSLEEP
|
||||
/bin/grep -E "\[emerg\]|\[alert\]" $templog
|
||||
}
|
||||
|
||||
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 $?
|
||||
;;
|
||||
configtest)
|
||||
do_configtest
|
||||
;;
|
||||
upgrade)
|
||||
do_upgrade
|
||||
;;
|
||||
reload|force-reload)
|
||||
log_daemon_msg "Reloading $DESC" "$NAME"
|
||||
do_reload
|
||||
log_end_msg $?
|
||||
;;
|
||||
restart|force-reload)
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_configtest -q || exit $RETVAL
|
||||
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
|
||||
;;
|
||||
check-reload)
|
||||
do_checkreload
|
||||
RETVAL=0
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload|upgrade|configtest|check-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
177
etc/init.d/nginx-debug
Executable file
177
etc/init.d/nginx-debug
Executable file
@@ -0,0 +1,177 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: nginx-debug
|
||||
# Required-Start: $network $remote_fs $local_fs
|
||||
# Required-Stop: $network $remote_fs $local_fs
|
||||
# Default-Start:
|
||||
# Default-Stop: 0 1 2 3 4 5 6
|
||||
# Short-Description: Stop/start nginx
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Sergey Budnevitch <sb@nginx.com>
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
|
||||
if [ -L $0 ]; then
|
||||
SCRIPTNAME=`/bin/readlink -f $0`
|
||||
else
|
||||
SCRIPTNAME=$0
|
||||
fi
|
||||
|
||||
sysconfig=`/usr/bin/basename $SCRIPTNAME`
|
||||
|
||||
[ -r /etc/default/$sysconfig ] && . /etc/default/$sysconfig
|
||||
|
||||
DESC=${DESC:-nginx-debug}
|
||||
NAME=${NAME:-nginx-debug}
|
||||
CONFFILE=${CONFFILE:-/etc/nginx/nginx.conf}
|
||||
DAEMON=${DAEMON:-/usr/sbin/nginx-debug}
|
||||
PIDFILE=${PIDFILE:-/var/run/nginx.pid}
|
||||
SLEEPSEC=${SLEEPSEC:-1}
|
||||
UPGRADEWAITLOOPS=${UPGRADEWAITLOOPS:-5}
|
||||
CHECKSLEEP=${CHECKSLEEP:-3}
|
||||
|
||||
[ -x $DAEMON ] || exit 0
|
||||
|
||||
DAEMON_ARGS="-c $CONFFILE $DAEMON_ARGS"
|
||||
|
||||
. /lib/init/vars.sh
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
do_start()
|
||||
{
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
||||
$DAEMON_ARGS
|
||||
RETVAL="$?"
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
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 --oknodo --retry=TERM/30/KILL/5 --pidfile $PIDFILE
|
||||
RETVAL="$?"
|
||||
rm -f $PIDFILE
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
do_reload() {
|
||||
#
|
||||
start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE
|
||||
RETVAL="$?"
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
do_configtest() {
|
||||
if [ "$#" -ne 0 ]; then
|
||||
case "$1" in
|
||||
-q)
|
||||
FLAG=$1
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
fi
|
||||
$DAEMON -t $FLAG -c $CONFFILE
|
||||
RETVAL="$?"
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
do_upgrade() {
|
||||
OLDBINPIDFILE=$PIDFILE.oldbin
|
||||
|
||||
do_configtest -q || return 6
|
||||
start-stop-daemon --stop --signal USR2 --quiet --pidfile $PIDFILE
|
||||
RETVAL="$?"
|
||||
|
||||
for i in `/usr/bin/seq $UPGRADEWAITLOOPS`; do
|
||||
sleep $SLEEPSEC
|
||||
if [ -f $OLDBINPIDFILE -a -f $PIDFILE ]; then
|
||||
start-stop-daemon --stop --signal QUIT --quiet --pidfile $OLDBINPIDFILE
|
||||
RETVAL="$?"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
echo $"Upgrade failed!"
|
||||
RETVAL=1
|
||||
return $RETVAL
|
||||
}
|
||||
|
||||
do_checkreload() {
|
||||
templog=`/bin/mktemp --tmpdir nginx-check-reload-XXXXXX.log`
|
||||
trap '/bin/rm -f $templog' 0
|
||||
/usr/bin/tail --pid=$$ -n 0 --follow=name /var/log/nginx/error.log > $templog &
|
||||
/bin/sleep 1
|
||||
start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE
|
||||
/bin/sleep $CHECKSLEEP
|
||||
/bin/grep -E "\[emerg\]|\[alert\]" $templog
|
||||
}
|
||||
|
||||
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 $?
|
||||
;;
|
||||
configtest)
|
||||
do_configtest
|
||||
;;
|
||||
upgrade)
|
||||
do_upgrade
|
||||
;;
|
||||
reload|force-reload)
|
||||
log_daemon_msg "Reloading $DESC" "$NAME"
|
||||
do_reload
|
||||
log_end_msg $?
|
||||
;;
|
||||
restart|force-reload)
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_configtest -q || exit $RETVAL
|
||||
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
|
||||
;;
|
||||
check-reload)
|
||||
do_checkreload
|
||||
RETVAL=0
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload|upgrade|configtest|check-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
34
etc/init.d/procps
Executable file
34
etc/init.d/procps
Executable file
@@ -0,0 +1,34 @@
|
||||
#! /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_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
|
||||
136
etc/init.d/supervisor
Executable file
136
etc/init.d/supervisor
Executable file
@@ -0,0 +1,136 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# skeleton example file to build /etc/init.d/ scripts.
|
||||
# This file should be used to construct scripts for /etc/init.d.
|
||||
#
|
||||
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
|
||||
# Modified for Debian
|
||||
# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
|
||||
# Further changes by Javier Fernandez-Sanguino <jfs@debian.org>
|
||||
#
|
||||
# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: supervisor
|
||||
# Required-Start: $remote_fs $network $named
|
||||
# Required-Stop: $remote_fs $network $named
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start/stop supervisor
|
||||
# Description: Start/stop supervisor daemon and its configured
|
||||
# subprocesses.
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
DAEMON=/usr/bin/supervisord
|
||||
NAME=supervisord
|
||||
DESC=supervisor
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
RETRY=TERM/30/KILL/5
|
||||
LOGDIR=/var/log/supervisor
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
DODTIME=5 # Time to wait for the server to die, in seconds
|
||||
# If this value is set too low you might not
|
||||
# let some servers to die gracefully and
|
||||
# 'restart' will not work
|
||||
|
||||
# Include supervisor defaults if available
|
||||
if [ -f /etc/default/supervisor ] ; then
|
||||
. /etc/default/supervisor
|
||||
fi
|
||||
DAEMON_OPTS="-c /etc/supervisor/supervisord.conf $DAEMON_OPTS"
|
||||
|
||||
set -e
|
||||
|
||||
running_pid()
|
||||
{
|
||||
# Check if a given process pid's cmdline matches a given name
|
||||
pid=$1
|
||||
name=$2
|
||||
[ -z "$pid" ] && return 1
|
||||
[ ! -d /proc/$pid ] && return 1
|
||||
(cat /proc/$pid/cmdline | tr "\000" "\n"|grep -q $name) || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
running()
|
||||
{
|
||||
# Check if the process is running looking at /proc
|
||||
# (works for all users)
|
||||
|
||||
# No pidfile, probably no daemon present
|
||||
[ ! -f "$PIDFILE" ] && return 1
|
||||
# Obtain the pid and check it against the binary name
|
||||
pid=`cat $PIDFILE`
|
||||
running_pid $pid $DAEMON || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting $DESC: "
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE \
|
||||
--startas $DAEMON -- $DAEMON_OPTS
|
||||
test -f $PIDFILE || sleep 1
|
||||
if running ; then
|
||||
echo "$NAME."
|
||||
else
|
||||
echo " ERROR."
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
echo -n "Stopping $DESC: "
|
||||
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
|
||||
echo "$NAME."
|
||||
;;
|
||||
#reload)
|
||||
#
|
||||
# If the daemon can reload its config files on the fly
|
||||
# for example by sending it SIGHUP, do it here.
|
||||
#
|
||||
# If the daemon responds to changes in its config file
|
||||
# directly anyway, make this a do-nothing entry.
|
||||
#
|
||||
# echo "Reloading $DESC configuration files."
|
||||
# start-stop-daemon --stop --signal 1 --quiet --pidfile \
|
||||
# /var/run/$NAME.pid --exec $DAEMON
|
||||
#;;
|
||||
force-reload)
|
||||
#
|
||||
# If the "reload" option is implemented, move the "force-reload"
|
||||
# option to the "reload" entry above. If not, "force-reload" is
|
||||
# just the same as "restart" except that it does nothing if the
|
||||
# daemon isn't already running.
|
||||
# check wether $DAEMON is running. If so, restart
|
||||
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE \
|
||||
--startas $DAEMON \
|
||||
&& $0 restart \
|
||||
|| exit 0
|
||||
;;
|
||||
restart)
|
||||
echo -n "Restarting $DESC: "
|
||||
start-stop-daemon --stop --retry=$RETRY --quiet --oknodo --pidfile $PIDFILE
|
||||
echo "$NAME."
|
||||
;;
|
||||
status)
|
||||
echo -n "$NAME is "
|
||||
if running ; then
|
||||
echo "running"
|
||||
else
|
||||
echo " not running."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
N=/etc/init.d/$NAME
|
||||
# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
|
||||
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
161
etc/init.d/syslog-ng
Executable file
161
etc/init.d/syslog-ng
Executable file
@@ -0,0 +1,161 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: syslog-ng
|
||||
# Required-Start: $local_fs $network $time $remote_fs
|
||||
# Required-Stop: $local_fs $network $time $remote_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Starting system logging daemon
|
||||
# Description: Starting syslog-NG, the next generation
|
||||
# syslog daemon.
|
||||
### END INIT INFO#
|
||||
|
||||
set -e
|
||||
|
||||
SYSLOGNG_OPTS=""
|
||||
|
||||
#we source /etc/default/syslog-ng if exists
|
||||
[ -r /etc/default/syslog-ng ] && . /etc/default/syslog-ng
|
||||
|
||||
# stop syslog-ng before changing its PID file!
|
||||
PIDFILE="/var/run/syslog-ng.pid"
|
||||
|
||||
SYSLOGNG="/usr/sbin/syslog-ng"
|
||||
NAME="syslog-ng"
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
test -f $SYSLOGNG || 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 "x$CONSOLE_LOG_LEVEL" in
|
||||
x[1-8])
|
||||
dmesg -n $CONSOLE_LOG_LEVEL
|
||||
;;
|
||||
x)
|
||||
;;
|
||||
*)
|
||||
log_warning_msg "CONSOLE_LOG_LEVEL is of unaccepted value."
|
||||
;;
|
||||
esac
|
||||
|
||||
create_xconsole() {
|
||||
XCONSOLE=/dev/xconsole
|
||||
if [ "$(uname -s)" = "GNU/kFreeBSD" ]; then
|
||||
XCONSOLE=/var/run/xconsole
|
||||
ln -sf $XCONSOLE /dev/xconsole
|
||||
fi
|
||||
if [ ! -e $XCONSOLE ]; then
|
||||
mknod -m 640 $XCONSOLE p
|
||||
chown root:adm $XCONSOLE
|
||||
[ -x /sbin/restorecon ] && /sbin/restorecon $XCONSOLE
|
||||
fi
|
||||
}
|
||||
|
||||
create_pidfiledir() {
|
||||
if [ ! -d /var/run/syslog-ng ]
|
||||
then
|
||||
mkdir -p /var/run/syslog-ng
|
||||
fi
|
||||
}
|
||||
|
||||
syslogng_wait() {
|
||||
if [ "$2" -ne 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
RET=1
|
||||
for i in $(seq 1 30); do
|
||||
status=0
|
||||
syslog-ng-ctl stats >/dev/null 2>&1 || status=$?
|
||||
if [ "$status" != "$1" ]; then
|
||||
RET=0
|
||||
break
|
||||
fi
|
||||
sleep 1s
|
||||
done
|
||||
return $RET
|
||||
}
|
||||
|
||||
syslogng_start() {
|
||||
log_daemon_msg "Starting system logging" "$NAME"
|
||||
create_pidfiledir
|
||||
create_xconsole
|
||||
start-stop-daemon --start --oknodo --quiet --exec "$SYSLOGNG" \
|
||||
--pidfile "$PIDFILE" -- -p "$PIDFILE" $SYSLOGNG_OPTS
|
||||
syslogng_wait 1 $?
|
||||
RET="$?"
|
||||
log_end_msg $RET
|
||||
return $RET
|
||||
}
|
||||
|
||||
syslogng_stop() {
|
||||
log_daemon_msg "Stopping system logging" "$NAME"
|
||||
start-stop-daemon --stop --oknodo --quiet --name "$NAME" --retry 3 \
|
||||
--pidfile "$PIDFILE"
|
||||
syslogng_wait 0 $?
|
||||
RET="$?"
|
||||
log_end_msg $RET
|
||||
return $RET
|
||||
}
|
||||
|
||||
syslogng_reload() {
|
||||
log_daemon_msg "Reload system logging" "$NAME"
|
||||
if $SYSLOGNG -s $SYSLOGNG_OPTS
|
||||
then
|
||||
start-stop-daemon --stop --signal 1 --quiet --exec "$SYSLOGNG" \
|
||||
--pidfile "$PIDFILE"
|
||||
syslogng_wait 1 $?
|
||||
RET="$?"
|
||||
log_end_msg $RET
|
||||
return $RET
|
||||
else
|
||||
log_end_msg 1
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
syslogng_start || exit 1
|
||||
;;
|
||||
stop)
|
||||
syslogng_stop || exit 1
|
||||
;;
|
||||
reload|force-reload)
|
||||
syslogng_reload || exit 1
|
||||
;;
|
||||
restart)
|
||||
syslogng_stop
|
||||
syslogng_start || exit 1
|
||||
;;
|
||||
try-restart)
|
||||
set +e
|
||||
killproc -p "$PIDFILE" "$SYSLOGNG" 0
|
||||
ISRUNNING=$?
|
||||
set -e
|
||||
if [ $ISRUNNING -eq 0 ]
|
||||
then
|
||||
# The syslog is currently running, so we restart it
|
||||
syslogng_stop
|
||||
syslogng_start || exit 1
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
status_of_proc "$SYSLOGNG" "$NAME" && exit 0 || exit $?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload|status}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
255
etc/init.d/udev
Executable file
255
etc/init.d/udev
Executable file
@@ -0,0 +1,255 @@
|
||||
#!/bin/sh -e
|
||||
### BEGIN INIT INFO
|
||||
# Provides: udev
|
||||
# Required-Start: mountkernfs
|
||||
# Required-Stop: umountroot
|
||||
# Default-Start: S
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Start systemd-udevd, populate /dev and load drivers.
|
||||
### END INIT INFO
|
||||
|
||||
PATH="/sbin:/bin"
|
||||
NAME="systemd-udevd"
|
||||
DAEMON="/lib/systemd/systemd-udevd"
|
||||
DESC="hotplug events dispatcher"
|
||||
PIDFILE="/run/udev.pid"
|
||||
CTRLFILE="/run/udev/control"
|
||||
OMITDIR="/run/sendsigs.omit.d"
|
||||
|
||||
# we need to unmount /dev/pts/ and remount it later over the devtmpfs
|
||||
unmount_devpts() {
|
||||
if mountpoint -q /dev/pts/; then
|
||||
umount -n -l /dev/pts/
|
||||
fi
|
||||
|
||||
if mountpoint -q /dev/shm/; then
|
||||
umount -n -l /dev/shm/
|
||||
fi
|
||||
}
|
||||
|
||||
# mount a devtmpfs over /dev, if somebody did not already do it
|
||||
mount_devtmpfs() {
|
||||
if grep -E -q "^[^[:space:]]+ /dev devtmpfs" /proc/mounts; then
|
||||
mount -n -o remount,nosuid,size=$tmpfs_size,mode=0755 -t devtmpfs devtmpfs /dev
|
||||
return
|
||||
fi
|
||||
|
||||
if ! mount -n -o nosuid,size=$tmpfs_size,mode=0755 -t devtmpfs devtmpfs /dev; then
|
||||
log_failure_msg "udev requires devtmpfs support, not started"
|
||||
log_end_msg 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
create_dev_makedev() {
|
||||
if [ -e /sbin/MAKEDEV ]; then
|
||||
ln -sf /sbin/MAKEDEV /dev/MAKEDEV
|
||||
else
|
||||
ln -sf /bin/true /dev/MAKEDEV
|
||||
fi
|
||||
}
|
||||
|
||||
# shell version of /usr/bin/tty
|
||||
my_tty() {
|
||||
[ -x /bin/readlink ] || return 0
|
||||
[ -e /proc/self/fd/0 ] || return 0
|
||||
readlink --silent /proc/self/fd/0 || true
|
||||
}
|
||||
|
||||
warn_if_interactive() {
|
||||
if [ "$RUNLEVEL" = "S" -a "$PREVLEVEL" = "N" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
TTY=$(my_tty)
|
||||
if [ -z "$TTY" -o "$TTY" = "/dev/console" -o "$TTY" = "/dev/null" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
printf "\n\n\nIt has been detected that the command\n\n\t$0 $*\n\n"
|
||||
printf "has been run from an interactive shell.\n"
|
||||
printf "It will probably not do what you expect, so this script will wait\n"
|
||||
printf "60 seconds before continuing. Press ^C to stop it.\n"
|
||||
printf "RUNNING THIS COMMAND IS HIGHLY DISCOURAGED!\n\n\n\n"
|
||||
sleep 60
|
||||
}
|
||||
|
||||
make_static_nodes() {
|
||||
[ -e /lib/modules/$(uname -r)/modules.devname ] || return 0
|
||||
[ -x /bin/kmod ] || return 0
|
||||
|
||||
/bin/kmod static-nodes --format=tmpfiles --output=/proc/self/fd/1 | \
|
||||
while read type name mode uid gid age arg; do
|
||||
[ -e $name ] && continue
|
||||
case "$type" in
|
||||
c|b|c!|b!) mknod -m $mode $name $type $(echo $arg | sed 's/:/ /') ;;
|
||||
d|d!) mkdir $name ;;
|
||||
*) echo "unparseable line ($type $name $mode $uid $gid $age $arg)" >&2 ;;
|
||||
esac
|
||||
|
||||
if [ -x /sbin/restorecon ]; then
|
||||
/sbin/restorecon $name
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
##############################################################################
|
||||
|
||||
|
||||
[ -x $DAEMON ] || exit 0
|
||||
|
||||
# defaults
|
||||
tmpfs_size="10M"
|
||||
|
||||
if [ -e /etc/udev/udev.conf ]; then
|
||||
. /etc/udev/udev.conf
|
||||
fi
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
if [ ! -e /proc/filesystems ]; then
|
||||
log_failure_msg "udev requires a mounted procfs, not started"
|
||||
log_end_msg 1
|
||||
fi
|
||||
|
||||
if ! grep -q '[[:space:]]devtmpfs$' /proc/filesystems; then
|
||||
log_failure_msg "udev requires devtmpfs support, not started"
|
||||
log_end_msg 1
|
||||
fi
|
||||
|
||||
if [ ! -d /sys/class/ ]; then
|
||||
log_failure_msg "udev requires a mounted sysfs, not started"
|
||||
log_end_msg 1
|
||||
fi
|
||||
|
||||
if [ ! -w /sys ]; then
|
||||
log_warning_msg "udev does not support containers, not started"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -d /sys/class/mem/null -a ! -L /sys/class/mem/null ] || \
|
||||
[ -e /sys/block -a ! -e /sys/class/block ]; then
|
||||
log_warning_msg "CONFIG_SYSFS_DEPRECATED must not be selected"
|
||||
log_warning_msg "Booting will continue in 30 seconds but many things will be broken"
|
||||
sleep 30
|
||||
fi
|
||||
|
||||
# When modifying this script, do not forget that between the time that the
|
||||
# new /dev has been mounted and udevadm trigger has been run there will be
|
||||
# no /dev/null. This also means that you cannot use the "&" shell command.
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ ! -e "/run/udev/" ]; then
|
||||
warn_if_interactive
|
||||
fi
|
||||
|
||||
if [ -w /sys/kernel/uevent_helper ]; then
|
||||
echo > /sys/kernel/uevent_helper
|
||||
fi
|
||||
|
||||
if ! mountpoint -q /dev/; then
|
||||
unmount_devpts
|
||||
mount_devtmpfs
|
||||
[ -d /proc/1 ] || mount -n /proc
|
||||
fi
|
||||
|
||||
make_static_nodes
|
||||
|
||||
# clean up parts of the database created by the initramfs udev
|
||||
udevadm info --cleanup-db
|
||||
|
||||
# set the SELinux context for devices created in the initramfs
|
||||
[ -x /sbin/restorecon ] && /sbin/restorecon -R /dev
|
||||
|
||||
log_daemon_msg "Starting $DESC" "$NAME"
|
||||
if start-stop-daemon --start --name $NAME --user root --quiet \
|
||||
--pidfile $PIDFILE --exec $DAEMON --background --make-pidfile \
|
||||
--notify-await; then
|
||||
# prevents udevd to be killed by sendsigs (see #791944)
|
||||
mkdir -p $OMITDIR
|
||||
ln -sf $PIDFILE $OMITDIR/$NAME
|
||||
log_end_msg $?
|
||||
else
|
||||
log_warning_msg $?
|
||||
log_warning_msg "Waiting 15 seconds and trying to continue anyway"
|
||||
sleep 15
|
||||
fi
|
||||
|
||||
log_action_begin_msg "Synthesizing the initial hotplug events (subsystems)"
|
||||
if udevadm trigger --type=subsystems --action=add; then
|
||||
log_action_end_msg $?
|
||||
else
|
||||
log_action_end_msg $?
|
||||
fi
|
||||
log_action_begin_msg "Synthesizing the initial hotplug events (devices)"
|
||||
if udevadm trigger --type=devices --action=add; then
|
||||
log_action_end_msg $?
|
||||
else
|
||||
log_action_end_msg $?
|
||||
fi
|
||||
|
||||
create_dev_makedev
|
||||
|
||||
# wait for the systemd-udevd childs to finish
|
||||
log_action_begin_msg "Waiting for /dev to be fully populated"
|
||||
if udevadm settle; then
|
||||
log_action_end_msg 0
|
||||
else
|
||||
log_action_end_msg 0 'timeout'
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
if start-stop-daemon --stop --name $NAME --user root --quiet \
|
||||
--pidfile $PIDFILE --remove-pidfile --oknodo --retry 5; then
|
||||
# prevents cryptsetup/dmsetup hangs (see #791944)
|
||||
rm -f $CTRLFILE
|
||||
log_end_msg $?
|
||||
else
|
||||
log_end_msg $?
|
||||
fi
|
||||
;;
|
||||
|
||||
restart)
|
||||
log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
if start-stop-daemon --stop --name $NAME --user root --quiet \
|
||||
--pidfile $PIDFILE --remove-pidfile --oknodo --retry 5; then
|
||||
# prevents cryptsetup/dmsetup hangs (see #791944)
|
||||
rm -f $CTRLFILE
|
||||
log_end_msg $?
|
||||
else
|
||||
log_end_msg $? || true
|
||||
fi
|
||||
|
||||
log_daemon_msg "Starting $DESC" "$NAME"
|
||||
if start-stop-daemon --start --name $NAME --user root --quiet \
|
||||
--pidfile $PIDFILE --exec $DAEMON --background --make-pidfile \
|
||||
--notify-await; then
|
||||
# prevents udevd to be killed by sendsigs (see #791944)
|
||||
mkdir -p $OMITDIR
|
||||
ln -sf $PIDFILE $OMITDIR/$NAME
|
||||
log_end_msg $?
|
||||
else
|
||||
log_end_msg $?
|
||||
fi
|
||||
;;
|
||||
|
||||
reload|force-reload)
|
||||
udevadm control --reload-rules
|
||||
;;
|
||||
|
||||
status)
|
||||
status_of_proc $DAEMON $NAME && exit 0 || exit $?
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: /etc/init.d/udev {start|stop|restart|reload|force-reload|status}" >&2
|
||||
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 which 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:
|
||||
Reference in New Issue
Block a user