Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4

Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4

Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4

Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4

Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4

Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
hwclock.sh000066600000011705150770332110006541 0ustar00#!/bin/sh # hwclock.sh Set and adjust the CMOS clock, according to the UTC # setting in /etc/default/rcS (see also rcS(5)). # # Version: @(#)hwclock.sh 2.00 14-Dec-1998 miquels@cistron.nl # # Patches: # 2000-01-30 Henrique M. Holschuh # - 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. # WARNING: Please read /usr/share/doc/util-linux/README.Debian.hwclock # before changing this file. You risk serious clock # misbehaviour otherwise. ### BEGIN INIT INFO # Provides: hwclock # Required-Start: checkroot # Required-Stop: $local_fs # Default-Start: S # Default-Stop: 0 6 ### END INIT INFO FIRST=no # debian/rules sets this to 'yes' when creating hwclockfirst.sh # Set this to any options you might need to give to hwclock, such # as machine hardware clock type for Alphas. HWCLOCKPARS= # Set this to the hardware clock device you want to use, it should # probably match the CONFIG_RTC_HCTOSYS_DEVICE kernel config option. HCTOSYS_DEVICE=rtc0 hwclocksh() { [ ! -x /sbin/hwclock ] && return 0 [ ! -r /etc/default/rcS ] || . /etc/default/rcS . /lib/lsb/init-functions verbose_log_action_msg() { [ "$VERBOSE" = no ] || log_action_msg "$@"; } [ "$GMT" = "-u" ] && UTC="yes" case "$UTC" in no|"") GMT="--localtime" UTC="" if [ "X$FIRST" = "Xyes" ] && [ ! -r /etc/localtime ]; then if [ -z "$TZ" ]; then log_action_msg "System clock was not updated at this time" return 1 fi fi ;; yes) GMT="--utc" UTC="--utc" ;; *) log_action_msg "Unknown UTC setting: \"$UTC\""; return 1 ;; esac case "$BADYEAR" in no|"") BADYEAR="" ;; yes) BADYEAR="--badyear" ;; *) log_action_msg "unknown BADYEAR setting: \"$BADYEAR\""; return 1 ;; esac case "$1" in start) if [ -d /dev/.udev ]; then return 0 fi if [ -w /etc ] && [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; then echo "0.0 0 0.0" > /etc/adjtime fi if [ ! -w /etc/adjtime ]; then NOADJ="--noadjfile" else NOADJ="" fi if [ "$FIRST" != yes ]; then # Uncomment the hwclock --adjust line below if you want # hwclock to try to correct systematic drift errors in the # Hardware Clock. # # WARNING: If you uncomment this option, you must either make # sure *nothing* changes the Hardware Clock other than # hwclock --systohc, or you must delete /etc/adjtime # every time someone else modifies the Hardware Clock. # # Common "vilains" are: ntp, MS Windows, the BIOS Setup # program. # # WARNING: You must remember to invalidate (delete) # /etc/adjtime if you ever need to set the system clock # to a very different value and hwclock --adjust is being # used. # # Please read /usr/share/doc/util-linux/README.Debian.hwclock # before enabling hwclock --adjust. #/sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --adjust $GMT $BADYEAR : fi if [ "$HWCLOCKACCESS" != no ]; then log_action_msg "Setting the system clock" # 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 $GMT $HWCLOCKPARS $BADYEAR $NOADJ; 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 [ ! -w /etc/adjtime ]; then NOADJ="--noadjfile" else NOADJ="" fi if [ "$HWCLOCKACCESS" != no ]; then log_action_msg "Saving the system clock" if [ "$GMT" = "-u" ]; then GMT="--utc" fi if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --systohc $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then verbose_log_action_msg "Hardware Clock updated to `date`" fi else verbose_log_action_msg "Not saving System Clock" fi ;; show) if [ ! -w /etc/adjtime ]; then NOADJ="--noadjfile" else NOADJ="" fi if [ "$HWCLOCKACCESS" != no ]; then /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --show $GMT $HWCLOCKPARS $BADYEAR $NOADJ 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 "$@" reboot000066600000001177150770332110005772 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: reboot # Required-Start: # Required-Stop: # Default-Start: # Default-Stop: 6 # Short-Description: Execute the reboot command. # Description: ### END INIT INFO PATH=/sbin:/usr/sbin:/bin:/usr/bin . /lib/lsb/init-functions do_stop () { # Message should end with a newline since kFreeBSD may # print more stuff (see #323749) log_action_msg "Will now restart" reboot -d -f -i } case "$1" in start) # No-op ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) do_stop ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac samba000066600000005545150770332110005566 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: samba # Required-Start: $network $local_fs $remote_fs # Required-Stop: $network $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Should-Start: slapd # Should-Stop: slapd # Short-Description: start Samba daemons (nmbd and smbd) ### END INIT INFO # Defaults RUN_MODE="daemons" # Reads config file (will override defaults above) [ -r /etc/default/samba ] && . /etc/default/samba PIDDIR=/var/run/samba NMBDPID=$PIDDIR/nmbd.pid SMBDPID=$PIDDIR/smbd.pid # clear conflicting settings from the environment unset TMPDIR # See if the daemons are there test -x /usr/sbin/nmbd -a -x /usr/sbin/smbd || exit 0 . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting Samba daemons" # Make sure we have our PIDDIR, even if it's on a tmpfs install -o root -g root -m 755 -d $PIDDIR NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null` if [ "$NMBD_DISABLED" != 'Yes' ]; then log_progress_msg "nmbd" if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/nmbd -- -D then log_end_msg 1 exit 1 fi fi if [ "$RUN_MODE" != "inetd" ]; then log_progress_msg "smbd" if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/smbd -- -D; then log_end_msg 1 exit 1 fi fi log_end_msg 0 ;; stop) log_daemon_msg "Stopping Samba daemons" log_progress_msg "nmbd" start-stop-daemon --stop --quiet --pidfile $NMBDPID # Wait a little and remove stale PID file sleep 1 if [ -f $NMBDPID ] && ! ps h `cat $NMBDPID` > /dev/null then # Stale PID file (nmbd was succesfully stopped), # remove it (should be removed by nmbd itself IMHO.) rm -f $NMBDPID fi if [ "$RUN_MODE" != "inetd" ]; then log_progress_msg "smbd" start-stop-daemon --stop --quiet --pidfile $SMBDPID # Wait a little and remove stale PID file sleep 1 if [ -f $SMBDPID ] && ! ps h `cat $SMBDPID` > /dev/null then # Stale PID file (nmbd was succesfully stopped), # remove it (should be removed by smbd itself IMHO.) rm -f $SMBDPID fi fi log_end_msg 0 ;; reload) log_daemon_msg "Reloading /etc/samba/smb.conf" "smbd only" start-stop-daemon --stop --signal HUP --pidfile $SMBDPID log_end_msg 0 ;; restart|force-reload) $0 stop sleep 1 $0 start ;; status) status="0" NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null` if [ "$NMBD_DISABLED" != "Yes" ]; then status_of_proc -p $NMBDPID /usr/sbin/nmbd nmbd || status=$? fi if [ "$RUN_MODE" != "inetd" ]; then status_of_proc -p $SMBDPID /usr/sbin/smbd smbd || status=$? fi if [ "$NMBD_DISABLED" = "Yes" -a "$RUN_MODE" = "inetd" ]; then status="4" fi exit $status ;; *) echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload|status}" exit 1 ;; esac exit 0 sendmail000066600000101157150770332110006273 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: sendmail # Required-Start: $remote_fs $network $syslog # Required-Stop: $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 1 # Short-Description: powerful, efficient, and scalable Mail Transport Agent # Description: Sendmail is an alternative Mail Transport Agent (MTA) # for Debian. It is suitable for handling sophisticated # mail configurations, although this means that its # configuration can also be complex. Fortunately, simple # thing can be done easily, and complex thing are possible, # even if not easily understood ;) Sendmail is the *ONLY* # MTA with a Turing complete language to control *ALL* # aspects of delivery! ### END INIT INFO # Author: Marc-Christian Petersen PATH=/bin:/usr/bin:/sbin:/usr/sbin DESC="Mail Transport Agent (MTA)" NAME=sendmail DAEMON=/usr/sbin/$NAME DAEMON_ARGS="" 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/sendmail ] && . /etc/default/sendmail # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. . /lib/lsb/init-functions #!/bin/sh #----------------------------------------------------------------------------- # $Sendmail: sm_helper.sh,v 8.14.3 2010-09-21 11:05:34 cowboy Exp $ # # Copyright (c) 1998-2009 Richard Nelson. All Rights Reserved. # # Debian helper function script for Debian Sendmail # Note: this file supports 8.7.6 - 9.0.0 # # Notes (to all): # * # # Notes (to self): # * clean_queues fubar, esp wrt MSP # #----------------------------------------------------------------------------- # DEBUG=0; # Support stand-alone execution if [ -z "$DAEMON" ]; then PATH=/bin:/usr/bin:/sbin:/usr/sbin DESC="Mail Transport Agent (MTA)" NAME=sendmail DAEMON=/usr/sbin/$NAME DAEMON_ARGS="" 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/sendmail ] && . /etc/default/sendmail # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. . /lib/lsb/init-functions fi; # Can't do this earlier, the lsb inclusion is unsafe :( set -e; #------------------------------------------------------------------------------ # Parameters for the sendmail daemon # Do *NOT* touch these lines, instead, edit /etc/mail/sendmail.conf # The _PARMS lines are listed in precedence order #------------------------------------------------------------------------------ Get_Parameters () { # Main configuration parameters in /etc/mail/sendmail.conf DAEMON_MODE='Daemon'; DAEMON_PARMS=''; DAEMON_UID='root'; QUEUE_MODE="$DAEMON_MODE"; QUEUE_INTERVAL='10m'; QUEUE_PARMS=''; MSP_MODE="$QUEUE_MODE"; MSP_INTERVAL="$QUEUE_INTERVAL"; MSP_PARMS=""; MISC_PARMS=''; CRON_PARMS=''; LOG_CMDS='No'; # Secondary (non-documented) parameters in /etc/mail/sendmail.conf # Caveat Emptor: change these at your own risk - they impact several # disjoint pieces parts... SENDMAIL_ROOT='/var/run/sendmail'; MTA_DAEMON='/usr/sbin/sendmail-mta'; MTA_COMMAND='/usr/sbin/sendmail-mta'; MTA_A='-Am'; MTAL_L='-L sm-mta'; MTAL_L_QUEUE='-L sm-mta-queue'; MTAL_L_RUNQ='-L sm-mta-runq'; MTA_ROOT="${SENDMAIL_ROOT}/mta"; MTAL_PIDFILE="${MTA_ROOT}/sendmail.pid"; MTAL_SOCKET="${MTA_ROOT}/smsocket"; MTAL_CNTL="${MTA_ROOT}/smcontrol"; MTAQ_L='-L sm-que'; MTAQ_L_RUNQ='-L sm-que-runq'; MTAQ_PIDFILE="${MTA_ROOT}/queue.pid"; MTAQ_SOCKET="${MTA_ROOT}/qusocket"; MTAQ_CNTL="${MTA_ROOT}/qucontrol"; MSP_DAEMON='/usr/sbin/sendmail-msp'; MSP_COMMAND='/usr/sbin/sendmail-msp'; MSP_A='-Ac'; MSP_L='-L sm-msp'; MSP_L_QUEUE='-L sm-msp-queue'; MSP_ROOT="${SENDMAIL_ROOT}/msp"; MSP_PIDFILE="${MSP_ROOT}/sendmail.pid"; MSP_SOCKET="${MSP_ROOT}/smsocket"; MSP_CNTL="${MSP_ROOT}/smcontrol"; # Pull in any user modified variables if [ -f /etc/mail/sendmail.conf ]; then . /etc/mail/sendmail.conf; fi; # These can't be user customized SM_Get_Parameters='yes'; PATH='/bin:/usr/bin:/sbin:/usr/sbin'; STAMP_DIR="${SENDMAIL_ROOT}/stampdir"; START_MTAL_CMD="start-stop-daemon \ --pidfile $MTAL_PIDFILE \ --exec $MTA_DAEMON \ --startas $MTA_COMMAND \ --start"; STOP_MTAL_CMD="start-stop-daemon \ --pidfile $MTAL_PIDFILE \ --name sendmail-mta \ --stop"; SIGNAL_MTAL_CMD="start-stop-daemon \ --pidfile $MTAL_PIDFILE \ --name sendmail-mta \ --stop"; START_MTAQ_CMD="start-stop-daemon \ --pidfile $MTAQ_PIDFILE \ --make-pidfile \ --exec $MTA_DAEMON \ --startas $MTA_COMMAND \ --start"; STOP_MTAQ_CMD="start-stop-daemon \ --pidfile $MTAQ_PIDFILE \ --name sendmail-mta \ --stop"; SIGNAL_MTAQ_CMD="start-stop-daemon \ --pidfile $MTAQ_PIDFILE \ --name sendmail-mta \ --stop"; START_MSP_CMD="start-stop-daemon \ --pidfile $MSP_PIDFILE \ --exec $MSP_DAEMON \ --startas $MSP_COMMAND \ --chuid smmsp \ --start"; STOP_MSP_CMD="start-stop-daemon \ --pidfile $MSP_PIDFILE \ --name sendmail-msp \ --stop"; SIGNAL_MSP_CMD="start-stop-daemon \ --pidfile $MSP_PIDFILE \ --name sendmail-msp \ --stop"; NAME='sendmail'; FLAGS='defaults 50'; # Sanitize some keyword entries DAEMON_MODE=$(echo "$DAEMON_MODE" | tr '[:upper:]' '[:lower:]'); QUEUE_MODE=$(echo "$QUEUE_MODE" | tr '[:upper:]' '[:lower:]'); MSP_MODE=$(echo "$MSP_MODE" | tr '[:upper:]' '[:lower:]'); # See if we can share the listener and queue-runner daemon: # * Both must be in daemon mode # * They must have the same (possibly empty) parameters if [ "$DAEMON_MODE" = "daemon" \ -a \( \( "$QUEUE_MODE" = "cron" -o "$QUEUE_MODE" = "none" \) \ -o \( "$QUEUE_MODE" != "cron" \ -a "$QUEUE_MODE" != "none" \ -a "$DAEMON_PARMS" = "$QUEUE_PARMS" \ \) \ \) ]; then SPLIT_DAEMON=0; else SPLIT_DAEMON=1; fi; # Version dependant support: # 8.12.0+ M{TA,MSP}_A if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then MTA_A=''; MTAL_L=''; MTAL_L_QUEUE=''; MSP_A=''; MSP_L=''; MSP_L_QUEUE=''; fi; }; #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # enhanced sendmail startup #------------------------------------------------------------------------------ start_mta () { local result; result=0; # # Make sure /var/run/sendmail/ exists check_dirs; # # If already running, don't start it... if is_running mta; then log_warning_msg 'MTA is already running.'; return 1; fi; # # Check if we're going to run a daemon (and how many): daemon_check || result=$?; if [ "$result" -ne 0 ]; then return 0; fi; # # Mark restarted for communication betwixt here and /etc/mail/Makefile touch $STAMP_DIR/reload; # if [ "$DAEMON_MODE" = "daemon" ]; then # # Allow Unix (local) connections betwixt MSP/MTA: touch $MTAL_SOCKET; # # We can only afford to clean the MTA queues if running daemon mode, # otherwise, there is a chance that a cronjob might still be using # the queue... Thats also why we don't clean the MSP queues herein. #clean_queues; # # cd to a safe place to stash core files... cd $MTA_ROOT; CMD="$START_MTAL_CMD -- $MTAL_PARMS"; if [ "$LOG_CMDS" = "Yes" ]; then logger -i -p mail.debug -- "$0 $CMD"; fi; $CMD & # # Update permissions on smsocket sleep 2; chown $DAEMON_UID:smmsp $MTAL_SOCKET; chmod 0666 $MTAL_SOCKET; fi; # # Check for split daemon mode (separate listener/queue runner) if [ "$SPLIT_DAEMON" -eq 1 ]; then CMD="$START_MTAQ_CMD -- $MTAQ_PARMS"; if [ "$LOG_CMDS" = "Yes" ]; then logger -i -p mail.debug -- "$0 $CMD"; fi; $CMD & sleep 2; qp=`expr "${MTAQ_PARMS}" : '.*\(-qp[0-9]*[smhdw]\)'` || true; if [ -z "$qp" ]; then chmod 0664 $MTAQ_PIDFILE; else qc=`ps --no-headers -fCsendmail \ | egrep -e 'Queue control' \ | awk '{print $2}'`; if [ -z "$qc" ]; then rm -f $MTAQ_PIDFILE; else chmod 0664 $MTAQ_PIDFILE; printf "$qc\n$MTA_COMMAND $MTAQ_PARMS" > $MTAQ_PIDFILE; fi; fi; fi; # # if running split service, run the client queues (just to make sure) if check_msp; then $MSP_COMMAND -q $MSP_A $MSP_L_QUEUE $MSP_PARMS $MISC_PARMS; fi; return $result; }; start_msp () { local result; result=0; # # Make sure /var/run/sendmail/ exists check_dirs; # # If already running, don't start it... if is_running msp; then log_warning_msg 'MSP is already running.'; return 1; fi; # # Check to see if MSP mode is indeed available if ! check_msp; then return 0; fi; # # Check if we're going to run a daemon: if [ "$MSP_MODE" != 'daemon' ]; then return 0; fi; # # We can only afford to clean the MSP queues if running daemon mode, # otherwise, there is a chance that a cronjob might still be using # the queue... Thats also why we don't clean the MTA queues herein. #clean_queues /var/spool/mqueue-client; # # cd to a safe place to stash core files... cd $MSP_ROOT; $START_MSP_CMD -- \ $MSP_A $MSP_L -q${MSP_INTERVAL} $MSP_PARMS $MISC_PARMS & return $result; }; start_sendmail () { local result; # Update databases make_databases; result=0; start_mta || result=$?; if check_msp; then start_msp || true; fi; return $result; }; #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # enhanced sendmail reload #------------------------------------------------------------------------------ reload_mta () { local result; # # Make sure /var/run/sendmail/ exists check_dirs; # # Update databases make_databases; # # reload (signal -HUP) is *much* better/faster than stop/start # # Mark restarted for communication betwixt here and /etc/mail/Makefile touch $STAMP_DIR/reload; # # If not running, just start it... if ! is_running mta; then start_mta; fi; # # Is running, must signal it... result=0; $SIGNAL_MTAL_CMD --signal HUP --oknodo --quiet || result=$?; sleep 2; chown $DAEMON_UID:smmta $MTAL_SOCKET; chmod 0666 $MTAL_SOCKET; # # Check for split daemon mode (separate listener/queue runner) if [ "$SPLIT_DAEMON" -eq 1 ]; then $SIGNAL_MTAQ_CMD --signal HUP --oknodo --quiet || true; fi; return $result; }; reload_msp () { local result; result=0; # # Make sure /var/run/sendmail/ exists check_dirs; # # reload (signal -HUP) is *much* better/faster than stop/start # # If not running, just start it... if ! is_running msp; then start_msp; fi; # # Is running, must signal it... $SIGNAL_MSP_CMD --signal HUP --oknodo --quiet || result=$?; return $result; }; reload_sendmail () { local result; result=0; reload_mta || result=$?; if check_msp; then reload_msp || true; fi; return $result; }; #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # enhanced sendmail shutdown #------------------------------------------------------------------------------ stop_mta () { local result cnt; result=0; stopped=0; # # Make sure /var/run/sendmail/ exists check_dirs; # # If not running, don't stop it... if ! is_running mta; then return 0; fi; # # Is running, must stop it... $STOP_MTAL_CMD --signal TERM --quiet --oknodo > /dev/null; # # Now we have to wait until sendmail has _really_ stopped. # sleep 2; if $STOP_MTAL_CMD --signal TERM --quiet > /dev/null; then log_progress_msg ' Waiting .'; cnt=0; while $STOP_MTAL_CMD --signal TERM --quiet > /dev/null; do cnt=`expr $cnt + 1`; if [ $cnt -gt 60 ]; then # # Waited 120 seconds now. Fail. # echo -n ' Failed '; stopped=1; break; fi; sleep 2; log_progress_msg '.'; done; echo -n ' Done '; fi; # # Remove pidfile iff stopped if ! $STOP_MTAL_CMD --signal TERM --quiet > /dev/null; then rm -f "$MTAL_PIDFILE"; fi return $result; }; stop_queue () { local result cnt; result=0; stopped=0; # # Make sure /var/run/sendmail/ exists check_dirs; # # If not running, don't stop it... if ! is_running queue; then return 0; fi; # # Is running, must stop it... $STOP_MTAQ_CMD --signal TERM --quiet --oknodo > /dev/null; # # Now we have to wait until sendmail has _really_ stopped. # sleep 2; if $STOP_MTAQ_CMD --signal TERM --quiet > /dev/null; then log_progress_msg ' Waiting .'; cnt=0; while $STOP_MTAQ_CMD --signal TERM --quiet > /dev/null; do cnt=`expr $cnt + 1`; if [ $cnt -gt 60 ]; then # # Waited 120 seconds now. Fail. # echo -n ' Failed '; stopped=1; break; fi; sleep 2; log_progress_msg '.'; done; echo -n ' Done '; fi; # # Remove pidfile iff stopped if ! $STOP_MTAQ_CMD --signal TERM --quiet > /dev/null; then rm -f "$MTAQ_PIDFILE"; fi return $result; }; stop_msp () { local result cnt; result=0; stopped=0; # # Make sure /var/run/sendmail/ exists check_dirs; # # If not running, don't stop it... if ! is_running msp; then return 0; fi; # # Is running, must stop it... $STOP_MSP_CMD --signal TERM --quiet --oknodo > /dev/null; # # Now we have to wait until sendmail has _really_ stopped. # sleep 2; if $STOP_MSP_CMD --signal TERM --quiet > /dev/null; then log_progress_msg 'Waiting .'; cnt=0; while $STOP_MSP_CMD --signal TERM --quiet > /dev/null; do cnt=`expr $cnt + 1`; if [ $cnt -gt 60 ]; then # # Waited 120 seconds now. Fail. # echo -n ' Failed '; stopped=1; break; fi; sleep 2; log_progress_msg '.'; done; echo -n ' Done '; fi; # # Remove pidfile iff stopped if ! $STOP_MSP_CMD --signal TERM --quiet > /dev/null; then rm -f "$MSP_PIDFILE"; fi; return $result; }; stop_sendmail () { local result; result=0; if check_msp; then stop_msp || true; fi; stop_mta || result=$?; stop_queue || true; return $result; }; #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Check to see if sendmail is running #------------------------------------------------------------------------------ is_running () { local result; result=1; # # Make sure /var/run/sendmail/ exists check_dirs; # # Determine proper pidfile to check who=$(echo "$1" | tr '[:upper:]' '[:lower:]'); case $who in mta) PIDFILE="$MTAL_PIDFILE"; ;; queue) PIDFILE="$MTAQ_PIDFILE"; ;; msp) PIDFILE="$MSP_PIDFILE"; ;; *) PIDFILE="$1"; ;; esac; # # If no pidfile, not running # Extract pid/command and see if still running # Remove pidfile if app didn't # Also remove any control sockets if [ -s $PIDFILE ]; then PID=`head -n 1 $PIDFILE 2>/dev/null`; COMMAND=`tail -n 1 $PIDFILE`; if [ ! -z "`ps --no-heading $PID`" ]; then result=0; else rm -f $PIDFILE; case $who in mta) rm -f $MTAL_SOCKET $MTAL_CNTL; ;; queue) rm -f $MTAQ_SOCKET $MTAQ_CNTL; ;; msp) rm -f $MSP_SOCKET $MSP_CNTL; esac; fi; fi; return $result; }; #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Check to see if running split service (MTA, MSP) # Must be at 8.12.0+ for this support #------------------------------------------------------------------------------ check_msp () { local result; result=1; if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then result=1; elif [ -s /etc/mail/submit.cf ] \ && [ -s /etc/mail/submit.mc ]; then if grep -qEe "^[[:space:]]*\`?FEATURE\([[:space:]]*\`?msp" \ /etc/mail/submit.mc; then result=0; fi; fi; return $result; }; #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Miscellaneous sendmail command support for MSP/MTA split # mailstats, mailq, runq #------------------------------------------------------------------------------ newaliases () { # # Obtain parameters IFF needed if [ -z "$SM_Get_Parameters" ]; then Get_Parameters; fi; # $MTA_COMMAND $MTA_A -bi $*; }; hoststat () { # # Obtain parameters IFF needed if [ -z "$SM_Get_Parameters" ]; then Get_Parameters; fi; # $MTA_COMMAND $MTA_A -bh $*; }; purgestat () { local parms; parms=$(echo "$1" | tr '[:upper:]' '[:lower:]'); case $parms in n*) # Now parms='-O Timeout.hoststatus=1s'; shift; ;; *) parms=''; ;; esac; # # Obtain parameters IFF needed if [ -z "$SM_Get_Parameters" ]; then Get_Parameters; fi; # $MTA_COMMAND $MTA_A -bH $parms $*; }; mailstats () { # # Obtain parameters IFF needed if [ -z "$SM_Get_Parameters" ]; then Get_Parameters; fi; # # if running split service, show the client status first if check_msp; then echo 'MSP statistics...'; #check if we have a status file for the MSP statusfile=$(grep -Ee '^O StatusFile=/.*' \ /etc/mail/submit.cf | cut -d= -f2); if [ -n $statusfile ]; then /usr/lib/sm.bin/mailstats -C \ /etc/mail/submit.cf $* || true; fi; echo 'MTA statistics...'; fi; # # check if we have a status file for the MTA statusfile=$(grep -Ee '^O StatusFile=/.*' \ /etc/mail/sendmail.cf | cut -d= -f2); if [ -n $statusfile ]; then /usr/lib/sm.bin/mailstats $* || true; fi; }; mailq () { # # Obtain parameters IFF needed if [ -z "$SM_Get_Parameters" ]; then Get_Parameters; fi; # # if running split service, show the client queues first if check_msp; then echo 'MSP Queue status...'; # # Check to see if shared memory is in use (8.12.0+) if grep -qEe "^[[:space:]]*\`?define\(\`?confSHAREDMEMORYKEY'?[[:space:]]*,[[:space:]]*\`?0*[1-9]+[0-9]*'?[[:space:]]*\)" \ /etc/mail/submit.mc; then $MSP_COMMAND -bP || true; fi; $MSP_COMMAND -bp $MSP_A $MISC_PARMS $* || true; echo 'MTA Queue status...'; fi; # # Check to see if shared memory is in use (8.12.0+) if grep -qEe "^[[:space:]]*\`?define\(\`?confSHAREDMEMORYKEY'?[[:space:]]*,[[:space:]]*\`?0*[1-9]+[0-9]*'?[[:space:]]*\)" \ /etc/mail/sendmail.mc; then $MTA_COMMAND -bP || true; fi; $MTA_COMMAND -bp $MTA_A $MISC_PARMS $* || true; }; runq () { # # Obtain parameters IFF needed if [ -z "$SM_Get_Parameters" ]; then Get_Parameters; fi; # # if running split service, run the client queues first if check_msp; then echo 'Running the MSP queue...'; $MSP_COMMAND -q $MSP_A \ $MSP_L_QUEUE $MSP_PARMS $MISC_PARMS $* || true; echo 'Running the MTA queues...'; fi; if [ "$SPLIT_DAEMON" -eq 0 ]; then $MTA_COMMAND -q $MTA_A \ $MTAL_L_RUNQ $QUEUE_PARMS $MISC_PARMS $* || true; else $MTA_COMMAND -q $MTA_A \ $MTAQ_L_RUNQ $QUEUE_PARMS $MISC_PARMS $* || true; fi; }; control () { # # Obtain parameters IFF needed if [ -z "$SM_Get_Parameters" ]; then Get_Parameters; fi; local parms; parms="$*"; if [ -z "$parms" ]; then parms='help'; fi; if is_running mta; then /usr/share/sendmail/smcontrol.pl $parms; else echo 'MTA: is not running'; fi; }; #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Print status of running job(s) #------------------------------------------------------------------------------ status () { # # Make sure /var/run/sendmail/ exists check_dirs; # # Obtain parameters IFF needed if [ -z "$SM_Get_Parameters" ]; then Get_Parameters; fi; # # if running split service, check the client status first if check_msp; then if is_running msp; then echo "MSP: $PID $COMMAND"; ps -fwp $PID; if [ -S ${MSP_CNTL} ]; then /usr/share/sendmail/smcontrol.pl \ -f ${MSP_CNTL} status || true; fi; elif [ $MSP_MODE = 'cron' ]; then echo "MSP: is run via cron ($MSP_INTERVAL)"; elif [ $MSP_MODE = 'none' ]; then echo 'MSP: is disabled'; else echo 'MSP: is not running'; fi; fi; # # Check MTA listener if is_running mta; then echo "MTA: $PID $COMMAND"; ps -fwp $PID; if [ -S ${MTAL_CNTL} ]; then /usr/share/sendmail/smcontrol.pl \ -f ${MTAL_CNTL} status || true; fi; elif [ $DAEMON_MODE = 'inetd' ]; then echo 'MTA: is run via inetd'; elif [ $DAEMON_MODE = 'none' ]; then echo 'MTA: is disabled'; else echo 'MTA: is not running'; fi; # # Check for split daemon mode (separate listener/queue runner) if is_running queue; then echo "QUE: $PID $COMMAND"; ps -fwp $PID; if [ -S ${MTAQ_CNTL} ]; then /usr/share/sendmail/smcontrol.pl \ -f ${MTAQ_CNTL} status || true; fi; elif [ $QUEUE_MODE = 'cron' ]; then echo "QUE: is run via cron ($QUEUE_INTERVAL)"; elif [ $QUEUE_MODE = 'none' ]; then echo 'QUE: is disabled'; elif [ "$SPLIT_DAEMON" -eq 0 ]; then echo "QUE: Same as MTA"; else echo 'QUE: is not running'; fi; }; #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Cronjob handling #------------------------------------------------------------------------------ cron_mta () { # # Make sure /var/run/sendmail/ exists check_dirs; # # Obtain parameters IFF needed if [ -z "$SM_Get_Parameters" ]; then Get_Parameters; fi; # # If cron not needed, don't do queue running (though it wouldn't hurt) if [ $QUEUE_MODE = 'cron' ]; then # # If running a split (MTA/MSP) setup, we need to make sure that # messages not immediately accepted by the MTA get delivered. # Only run the MSP queue if MSP_MODE=none if check_msp; then if [ $MSP_MODE = 'none' ]; then # Make sure only *ONE* cronjob at a time if [ ! -f $STAMP_DIR/cron_msp ]; then touch $STAMP_DIR/cron_msp; #clean_queues /var/spool/mqueue-client; $MSP_COMMAND -qf $MSP_A $MSP_L_QUEUE \ $MSP_PARMS $MISC_PARMS \ $CRON_PARMS || true; rm -f $STAMP_DIR/cron_msp; fi; fi; fi; # Make sure only *ONE* cronjob at a time if [ ! -f $STAMP_DIR/cron_mta ]; then touch $STAMP_DIR/cron_mta; $MTA_COMMAND -qf $MTA_A $MTAL_L_QUEUE \ $QUEUE_PARMS $MISC_PARMS $CRON_PARMS || true; rm -f $STAMP_DIR/cron_mta; fi; fi; }; cron_msp () { # # Make sure /var/run/sendmail/ exists check_dirs; # # Obtain parameters IFF needed if [ -z "$SM_Get_Parameters" ]; then Get_Parameters; fi; # # If cron not needed, don't do queue running (though it wouldn't hurt) if [ $MSP_MODE = 'cron' ]; then # # If running a split (MTA/MSP) setup, we need to make sure that # messages not immediately accepted by the MTA get delivered. if check_msp; then # Make sure only *ONE* cronjob at a time if [ ! -f $STAMP_DIR/cron_msp ]; then touch $STAMP_DIR/cron_msp; #clean_queues /var/spool/mqueue-client; $MSP_COMMAND -qf $MSP_A $MSP_L_QUEUE \ $MSP_PARMS $MISC_PARMS \ $CRON_PARMS || true; rm -f $STAMP_DIR/cron_msp; fi; fi; fi; }; #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Determine how to run sendmail mta daemon # * No daemon # * As listener # * As queue runner # * As both listener and queue runner #------------------------------------------------------------------------------ daemon_check () { local run_daemon; # # Skip daemon run for the following: # * sendmail hasn't been configured # * DAEMON_MODE = (none | inet) & QUEUE_MODE = (none | cron) if [ ! -s /etc/mail/sendmail.cf ] || \ [ ! -s /etc/mail/sendmail.mc ]; then log_failure_msg 'Not configured, not started.'; return 1; fi; MTAL_PARMS="$MTA_A $MTAL_L"; MTAQ_PARMS="$MTA_A $MTAQ_L"; run_daemon=3; case "$DAEMON_MODE" in none* | \ inetd*) run_daemon=`expr $run_daemon - 1`; ;; daemon* | \ *) MTAL_PARMS="$MTAL_PARMS -bd $DAEMON_PARMS"; ;; esac; case "$QUEUE_MODE" in none* | \ cron*) run_daemon=`expr $run_daemon - 1`; ;; daemon* | \ *) # Check for split daemon mode (separate listener/queue runner) if [ $SPLIT_DAEMON -eq 0 ]; then if [ ! -z "$QUEUE_INTERVAL" ]; then MTAL_PARMS="$MTAL_PARMS -q${QUEUE_INTERVAL}"; fi; MTAL_PARMS="$MTAL_PARMS $QUEUE_PARMS"; else if [ ! -z "$QUEUE_INTERVAL" ]; then MTAQ_PARMS="$MTAQ_PARMS -q${QUEUE_INTERVAL}"; fi; MTAQ_PARMS="$MTAQ_PARMS $QUEUE_PARMS"; fi; ;; esac; # Add any miscellanous (ie debugging) parameters MTAL_PARMS="$MTAL_PARMS $MISC_PARMS"; MTAQ_PARMS="$MTAQ_PARMS $MISC_PARMS"; # Add PidFile override for MTA queue runner MTAQ_PARMS="$MTAQ_PARMS -O PidFile=$MTAQ_PIDFILE"; MTAQ_PARMS="$MTAQ_PARMS -O ControlSocketName=$MTAQ_CNTL"; if [ $run_daemon -lt 2 ]; then log_failure_msg 'listen/queue daemon not needed.'; return 1; fi; return 0; }; #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Simple routine to update the databases on start/refresh/restart #------------------------------------------------------------------------------ make_databases () { # # Life is so much simpler with make if test -x /usr/bin/make -a -f /etc/mail/Makefile; then /usr/bin/make all -s -C /etc/mail >/dev/null; # # Here, all I could do would be handle a *few* database - # quite frankly, it isn't worth it, someone will want yet another else echo "No make, you'll have to rebuild your databases by hand :("; fi; } #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Clean sendmail queues (somewhat): does *not* support split qf/df/xf dirs. # NOTE: This whole thing sucks with queue-groups, need to redo it!!! # NOTE: Check for race conditions betwixt this code and queue-runners #------------------------------------------------------------------------------ clean_queues () { local QUEUE_ROOT QUEUE QUIET # Obtain queue root directory if [ -z "$1" ]; then QUEUE_ROOT=/var/spool/mqueue QUEUE=/var/spool/mqueue QUIET='' else QUEUE_ROOT="$1" QUEUE="$1" QUIET='1' fi # remove lock files left because of kill/crash # rm -f $QUEUE/[lnx]f* doesn't work with a plethora of files ;-( for i in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \ a b c d e f g h i j k l m n o p q r s t u v w x y z; do rm -f $QUEUE/[lnx]f${i}* done # remove zero length qf files #for qffile in $QUEUE/qf*; do for qffile in $(find $QUEUE_ROOT -type f -name 'qf*'); do if [ -r "$qffile" ] && [ ! -s "$qffile" ]; then if [ ! -z "$QUIET" ]; then echo -n " "; fi rm -f "$qffile" fi done # rename tf files to be qf if the qf does not exist for tffile in $QUEUE/tf*; do qffile=`echo "$tffile" | sed 's/\/tf\([[:alnum:]]*\)$/\/qf\1/'` if [ -r "$tffile" ] && [ ! -f "$qffile" ]; then if [ ! -z "$QUIET" ]; then echo -n " "; fi mv "$tffile" "$qffile" elif [ -f "$tffile" ]; then echo -n " " rm -f "$tffile" fi done # remove df files with no corresponding qf files for dffile in $QUEUE/df*; do qffile=`echo "$dffile" | sed 's/\/df\([[:alnum:]]*\)$/\/qf\1/'` Dffile=`echo "$dffile" | sed 's/\/df\([[:alnum:]]*\)$/\/Df\1/'` if [ -r "$dffile" ] && [ ! -f "$qffile" ]; then if [ ! -s "$dffile" ]; then rm -f "$dffile" else if [ ! -z "$QUIET" ]; then echo -n " "; fi mv "$dffile" "$Dffile"; fi fi done # announce files that have been saved during disaster recovery for xffile in $QUEUE/[A-Z]f*; do if [ -f "$xffile" ]; then if [ ! -z "$QUIET" ]; then echo -n " "; fi fi done } #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # check_dirs: Make sure /var/run/sendmail/{mta,msp,stampdir} exist #------------------------------------------------------------------------------ check_dirs () { if [ ! -d "${SENDMAIL_ROOT}" ]; then mkdir -p "${SENDMAIL_ROOT}"; chown root:smmta "${SENDMAIL_ROOT}"; chmod 02755 "${SENDMAIL_ROOT}"; fi; if [ ! -d "${MTA_ROOT}" ]; then mkdir -p "${MTA_ROOT}"; chown $DAEMON_UID:smmta "${MTA_ROOT}"; chmod 02755 "${MTA_ROOT}"; fi; if [ ! -d "${MSP_ROOT}" ]; then mkdir -p "${MSP_ROOT}"; chown smmsp:smmsp "${MSP_ROOT}"; chmod 02775 "${MSP_ROOT}"; fi; if [ ! -d "${STAMP_DIR}" ]; then mkdir -p "${STAMP_DIR}"; chown root:smmsp "${STAMP_DIR}"; chmod 02775 "${STAMP_DIR}"; fi; } #------------------------------------------------------------------------------ # Why are we here ? #------------------------------------------------------------------------------ # Some requisite initialization if [ -z "$SM_Get_Parameters" ]; then Get_Parameters; fi; if [ "$LOG_CMDS" = "Yes" ]; then logger -i -p mail.debug -- "$0 $@"; fi; #------------------------------------------------------------------------------ # Handle being called via an alias #------------------------------------------------------------------------------ case $(basename $0) in newaliases) newaliases $*; exit $?; ;; hoststat) hoststat $*; exit $?; ;; purgestat) purgestat $*; exit $?; ;; mailstats) mailstats $*; exit $?; ;; mailq) mailq $*; exit $?; ;; runq) runq $*; exit $?; ;; control|smcontrol) control $*; exit $?; ;; status) status $* exit $? ;; *) : # Fall through and handle below ;; esac; #------------------------------------------------------------------------------ # Handle being called via /etc/init.d/sendmail or directly #------------------------------------------------------------------------------ # Ok, why are we here... case "$1" in #----------------------------------------------------------------------- # Debian required/optional targets: #----------------------------------------------------------------------- start) log_daemon_msg "Starting $DESC" "$NAME"; start_sendmail; log_end_msg $?; ;; stop|force-stop) log_daemon_msg "Stopping $DESC" "$NAME"; stop_sendmail; log_end_msg $?; ;; restart) log_daemon_msg "Restarting $DESC" "$NAME"; # reload is equivalent (but faster) than stop/start ! # but... it doesn't honor changes to /etc/mail/sendmail.conf #reload_sendmail; stop_sendmail; start_sendmail; log_end_msg $?; ;; restart-if-running) if ! is_running mta && ! is_running msp; then echo 'Mail Transport Agent: sendmail is not running'; else $0 restart; fi; ;; reload-if-running) if ! is_running mta && ! is_running msp; then echo 'Mail Transport Agent: sendmail is not running'; else $0 reload; fi; ;; reload|force-reload) log_daemon_msg "Reloading $DESC" "$NAME"; reload_sendmail; log_end_msg $?; ;; #----------------------------------------------------------------------- # Local targets (sendmail commands/aliases) for MSP/MTA split support # These targets will pass along any provided parameters #----------------------------------------------------------------------- newaliases) shift; newaliases $*; ;; hoststat) shift; hoststat $*; ;; purgestat) shift; purgestat $*; ;; mailstats) shift; mailstats $*; ;; mailq) shift; mailq $*; ;; runq) shift; runq $*; ;; control|smcontrol) shift; control $*; ;; #----------------------------------------------------------------------- # Local targets for extended support/debugging #----------------------------------------------------------------------- status) shift; status $*; ;; debug) # # If not running, can't debug if is_running msp; then echo -n 'Dumping MSP state...'; $SIGNAL_MSP_CMD --signal USR1; echo 'done.'; fi; if is_running mta; then echo -n 'Dumping MTA state...'; $SIGNAL_MTAL_CMD --signal USR1; echo 'done.'; fi; ;; clean|clean_que*|clean-que*) # # If running, don't clean the queues... if is_running mta; then echo 'MTA is running, queue cleaning ill advised...'; else echo -n 'Cleaning up the queues...'; clean_queues; echo 'done.'; fi; ;; #----------------------------------------------------------------------- # Local targets for cronjob support #----------------------------------------------------------------------- cron-msp) cron_msp; ;; cron-mta) cron_mta; ;; #----------------------------------------------------------------------- # Default target - bitch and moan #----------------------------------------------------------------------- *) echo "Invalid command <$1>"; echo "Usage: $0 "; echo ' Where is one of the following'; echo ' start|stop|restart|restart-if-running'; echo ' reload-if-running|reload|force-reload'; echo ' newaliases|hoststat|purgestat|mailstats|mailq|runq|control'; echo ' status|debug|clean'; exit 1; ;; esac; exit 0; mountoverflowtmp000066600000002443150770332110010144 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: mountoverflowtmp # Required-Start: mountall-bootclean # Required-Stop: umountfs # Default-Start: S # Default-Stop: # Short-Description: mount emergency /tmp. # Description: Mount a tmpfs on /tmp if there would # otherwise be too little space to log in. ### END INIT INFO . /lib/init/vars.sh . /lib/lsb/init-functions set -e defs=/etc/default/mountoverflowtmp test ! -f "$defs" || . "$defs" : ${MINTMPKB:=1024} if test "$MINTMPKB" = "0"; then exit 0; fi case "$1" in start) [ "$VERBOSE" != no ] && log_action_begin_msg "Checking minimum space in /tmp" df="`LC_ALL=C df -kP /tmp | grep -v Filesystem`" set -- $df avail="$4" [ "$VERBOSE" != no ] && log_action_end_msg 0 if test $avail -lt "$MINTMPKB"; then log_action_begin_msg "Mounting emergency tmpfs on /tmp" mount -t tmpfs -o size=1048576,mode=1777 overflow /tmp log_action_end_msg 0 fi ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) if LC_ALL=C mount | \ grep '^overflow on /tmp type tmpfs' >/dev/null; then log_action_begin_msg "Unmounting any overflow tmpfs from /tmp" umount overflow log_action_end_msg 0 fi ;; *) echo "Usage: mountoverflowtmp [start|stop]" >&2 exit 3 ;; esac : klogd000066600000002700150770332110005571 0ustar00#! /bin/sh # /etc/init.d/klogd: start the kernel log daemon. ### BEGIN INIT INFO # Provides: klogd # Required-Start: $syslog # Required-Stop: $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Kernel logger ### END INIT INFO PATH=/bin:/usr/bin:/sbin:/usr/sbin pidfile=/var/run/klogd.pid binpath=/sbin/klogd test -f $binpath || exit 0 test ! -r /etc/default/klogd || . /etc/default/klogd . /lib/lsb/init-functions case "$1" in start) log_begin_msg "Starting kernel log daemon..." start-stop-daemon --start --quiet --pidfile $pidfile --name klogd --startas $binpath -- $KLOGD log_end_msg $? test -d /lib/init/rw/sendsigs.omit.d || mkdir -p /lib/init/rw/sendsigs.omit.d test ! -f /lib/init/rw/sendsigs.omit.d/klogd || rm -f /lib/init/rw/sendsigs.omit.d/klogd ln -s $pidfile /lib/init/rw/sendsigs.omit.d/klogd ;; stop) log_begin_msg "Stopping kernel log daemon..." start-stop-daemon --stop --quiet --retry 3 --exec $binpath --pidfile $pidfile log_end_msg $? ;; restart|force-reload) log_begin_msg "Reloading kernel log daemon..." start-stop-daemon --stop --quiet --retry 3 --exec $binpath --pidfile $pidfile start-stop-daemon --start --quiet --pidfile $pidfile --name klogd --startas $binpath -- $KLOGD log_end_msg $? ;; *) log_success_msg "Usage: /etc/init.d/klogd {start|stop|restart|force-reload}" exit 1 esac exit 0 ntp000066600000003426150770332110005300 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: ntp # Required-Start: $network $remote_fs $syslog # Required-Stop: $network $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Start NTP daemon ### END INIT INFO PATH=/sbin:/bin:/usr/sbin:/usr/bin . /lib/lsb/init-functions DAEMON=/usr/sbin/ntpd PIDFILE=/var/run/ntpd.pid test -x $DAEMON || exit 5 if [ -r /etc/default/ntp ]; then . /etc/default/ntp fi if [ -e /var/lib/ntp/ntp.conf.dhcp ]; then NTPD_OPTS="$NTPD_OPTS -c /var/lib/ntp/ntp.conf.dhcp" fi LOCKFILE=/var/lock/ntpdate lock_ntpdate() { if [ -x /usr/bin/lockfile-create ]; then lockfile-create $LOCKFILE lockfile-touch $LOCKFILE & LOCKTOUCHPID="$!" fi } unlock_ntpdate() { if [ -x /usr/bin/lockfile-create ] ; then kill $LOCKTOUCHPID lockfile-remove $LOCKFILE fi } RUNASUSER=ntp UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true if test "$(uname -s)" = "Linux"; then NTPD_OPTS="$NTPD_OPTS -u $UGID" fi case $1 in start) log_daemon_msg "Starting NTP server" "ntpd" if [ -z "$UGID" ]; then log_failure_msg "user \"$RUNASUSER\" does not exist" exit 1 fi lock_ntpdate start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -p $PIDFILE $NTPD_OPTS status=$? unlock_ntpdate log_end_msg $status ;; stop) log_daemon_msg "Stopping NTP server" "ntpd" start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE log_end_msg $? rm -f $PIDFILE ;; restart|force-reload) $0 stop && sleep 2 && $0 start ;; try-restart) if $0 status >/dev/null; then $0 restart else exit 0 fi ;; reload) exit 3 ;; status) status_of_proc $DAEMON "NTP server" ;; *) echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}" exit 2 ;; esac quotarpc000066600000003457150770332110006341 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: quotarpc # Short-Description: Starts rpc process for remote quota handling # Required-Start: $remote_fs $syslog quota # Required-Stop: $remote_fs $syslog quota # Should-Start: $portmap rpcbind # Should-Stop: $portmap rpcbind # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin NAME=rpc.rquotad DESC="quota service" # names of binaries DAEMON=/usr/sbin/rpc.rquotad # check if quota are enabled if test -f /etc/exports && grep -q '^[^#]*quota' /etc/fstab && grep -q '^/' /etc/exports; then need_rquotad=1 else need_rquotad=0 fi test -f $DAEMON || exit 0 . /lib/lsb/init-functions # check if there are some options to rpc.rquotad test -f /etc/default/quota && . /etc/default/quota pidp=`pidof portmap` pidr=`pidof rpcbind` set -e case "$1" in start) # To start the daemon, portmap must be up and running if [ -x $DAEMON ] && [ $need_rquotad = 1 ]; then if [ -z "$pidp" ] && [ -z "$pidr" ] ; then log_warning_msg "Not starting $DESC rpc.rquotad, because neither portmap nor rcpbind are running" else log_daemon_msg "Starting $DESC" "rpc.rquotad" start-stop-daemon --start --quiet --exec $DAEMON -- $RPCRQUOTADOPTS log_end_msg $? fi fi ;; stop) log_daemon_msg "Stopping $DESC" "rpc.rquotad" start-stop-daemon --stop --quiet --oknodo --exec $DAEMON log_end_msg $? ;; restart|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". # $0 stop $0 start ;; status) status_of_proc $DAEMON quotarpc ;; *) echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2 exit 1 ;; esac exit 0 umountfs000066600000005465150770332110006364 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: umountfs # Required-Start: # Required-Stop: umountroot # Default-Start: # Default-Stop: 0 6 # Short-Description: Turn off swap and unmount all local file systems. # Description: ### END INIT INFO PATH=/sbin:/usr/sbin:/bin:/usr/bin . /lib/init/vars.sh . /lib/lsb/init-functions umask 022 do_stop () { exec 9<&0 /dev/null log_action_end_msg $? else log_daemon_msg "Will now deactivate swap" swapoff -a -v log_end_msg $? fi # # Unmount local filesystems # if [ "$WEAK_MTPTS" ]; then # Do not use -f umount option for WEAK_MTPTS if [ "$VERBOSE" = no ] then log_action_begin_msg "Unmounting weak filesystems" fstab-decode umount -r -d $WEAK_MTPTS log_action_end_msg $? else log_daemon_msg "Will now unmount weak filesystems" fstab-decode umount -v -r -d $WEAK_MTPTS log_end_msg $? fi fi if [ "$REG_MTPTS" ] then if [ "$VERBOSE" = no ] then log_action_begin_msg "Unmounting local filesystems" fstab-decode umount -f -r -d $REG_MTPTS log_action_end_msg $? else log_daemon_msg "Will now unmount local filesystems" fstab-decode umount -f -v -r -d $REG_MTPTS log_end_msg $? fi fi } case "$1" in start) # No-op ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) do_stop ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac : atd000066600000002057150770332110005246 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: atd # Required-Start: $syslog $time $remote_fs # Required-Stop: $syslog $time $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Deferred execution scheduler # Description: Debian init script for the atd deferred executions # scheduler ### END INIT INFO # # Author: Ryan Murray # PATH=/bin:/usr/bin:/sbin:/usr/sbin DAEMON=/usr/sbin/atd PIDFILE=/var/run/atd.pid test -x $DAEMON || exit 0 . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting deferred execution scheduler" "atd" start_daemon -p $PIDFILE $DAEMON log_end_msg $? ;; stop) log_daemon_msg "Stopping deferred execution scheduler" "atd" killproc -p $PIDFILE $DAEMON log_end_msg $? ;; force-reload|restart) $0 stop $0 start ;; status) status_of_proc -p $PIDFILE $DAEMON atd && exit 0 || exit $? ;; *) echo "Usage: /etc/init.d/atd {start|stop|restart|force-reload|status}" exit 1 ;; esac exit 0 hdparm000066600000024514150770332110005753 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: hdparm # Required-Start: mountdevsubfs # Required-Stop: # Should-Start: udev # Default-Start: S # Default-Stop: # Short-Description: Tune IDE hard disks ### END INIT INFO set -e . /lib/lsb/init-functions # Defaults for configuration variables. RAID_WORKAROUND=no # Source the defaults file. [ -e /etc/default/hdparm ] && . /etc/default/hdparm raid_speed_limit_min= raid_speed_limit_max= case "$0" in *hdparm) FIRST=yes ;; *) FIRST=no ;; esac case "$1" in start|restart|reload|force-reload) UDEV=no ;; hotplug) UDEV=yes [ "$DEVNAME" ] || exit 1 ;; stop) exit 0 ;; *) log_failure_msg "Usage: $0 {stop|start|restart|reload|force-reload|hotplug}" >&2 exit 3 ;; esac if [ "$FORCE_RUN" != 'yes' ]; then if [ -e /proc/cmdline ]; then #linux only - future proofing against BSD and Hurd :) if grep -wq "nohdparm" /proc/cmdline ; then log_warning_msg "Skipping setup of disc parameters." exit 0 fi fi raidstat=OK if [ -e /proc/mdstat ]; then if egrep -iq "resync|repair|recover|check" /proc/mdstat; then raidstat=RESYNC fi elif [ -e /proc/rd/status ]; then raidstat=`cat /proc/rd/status` fi if ! [ "$raidstat" = 'OK' ] && [ "$RAID_WORKAROUND" != "yes" ]; then log_failure_msg "RAID status not OK. Exiting." exit 0 fi fi slow_down_raid_sync() { if [ -f /proc/sys/dev/raid/speed_limit_min ]; then raid_speed_limit_min=`cat /proc/sys/dev/raid/speed_limit_min` echo 0 >/proc/sys/dev/raid/speed_limit_min fi if [ -f /proc/sys/dev/raid/speed_limit_max ]; then raid_speed_limit_max=`cat /proc/sys/dev/raid/speed_limit_max` echo 0 >/proc/sys/dev/raid/speed_limit_max fi sleep 2 trap undo_slow_down_raid_sync EXIT } undo_slow_down_raid_sync() { if [ -f /proc/sys/dev/raid/speed_limit_min ] && [ "x$raid_speed_limit_min" != "x" ]; then echo $raid_speed_limit_min >/proc/sys/dev/raid/speed_limit_min fi if [ -f /proc/sys/dev/raid/speed_limit_max ] && [ "x$raid_speed_limit_max" != "x" ]; then echo $raid_speed_limit_max >/proc/sys/dev/raid/speed_limit_max fi } set_option() { if test -n "$DISC"; then NEW_OPT= for i in $OPTIONS; do if test x${i%${i#??}} != x${1%${1#??}}; then NEW_OPT="$NEW_OPT $i" else NEW_OPT=${NEW_OPT%-q} fi done OPTIONS="$NEW_OPT $OPT_QUIET $1" else NEW_DEF= for i in $DEFAULT; do if test x${i%${i#??}} != x${1%${1#??}}; then NEW_DEF="$NEW_DEF $i" else NEW_DEF=${NEW_DEF%-q} fi done DEFAULT="$NEW_DEF $DEF_QUIET $1" fi } eval_value() { case $1 in off|0) set_option "$2"0 ;; on|1) set_option "$2"1 ;; *) log_failure_msg "Unknown Value for $2: $1" exit 1 ;; esac } WAS_RUN=0 # Turn off RAID synchronisation if needed and asked for. if [ "$raidstat" != 'OK' ] && [ "$RAID_WORKAROUND" = "yes" ]; then slow_down_raid_sync fi # Get blocks as far as the drive's write cache. /bin/sync [ "$UDEV" = 'yes' ] || log_daemon_msg "Setting parameters of disc" DISC= DEFAULT= OPTIONS= DEF_QUIET= OPT_QUIET= egrep -v '^[[:space:]]*(#|$)' /etc/hdparm.conf | { while read KEY SEP VALUE; do if [ "$NEXT_LINE" != 'go' ]; then case $SEP in '{') case $KEY in command_line) NEXT_LINE=go unset DISC unset OPTIONS unset OPT_QUIET if [ "$UDEV" = 'yes' ]; then IN_BLOCK=0 fi ;; *) if [ -h "$KEY" ]; then DISC=$(readlink -m "$KEY") else DISC=$KEY fi OPTIONS=$DEFAULT OPT_QUIET=$DEF_QUIET WAS_RUN=0 if [ "$UDEV" = 'yes' ]; then if [ "$DISC" = "$DEVNAME" ]; then IN_BLOCK=1 else IN_BLOCK=0 fi fi ;; esac ;; =) case $KEY in read_ahead_sect) set_option -a$VALUE ;; lookahead) eval_value $VALUE -A ;; bus) eval_value $VALUE -b ;; apm) set_option -B$VALUE ;; io32_support) set_option -c$VALUE ;; dma) eval_value $VALUE -d ;; defect_mana) eval_value $VALUE -D ;; cd_speed) set_option -E$VALUE ;; mult_sect_io) set_option -m$VALUE ;; prefetch_sect) set_option -P$VALUE ;; read_only) eval_value $VALUE -r ;; spindown_time) case "$VALUE" in *[hms]) case "$VALUE" in *h) time=$((${VALUE%h} * 3600)) ;; *m) time=$((${VALUE%m} * 60)) ;; *s) time=${VALUE%s} ;; esac if [ $time -lt 1260 ]; then # up to 21 minutes new_VALUE=$(($time / 5)) if [ $new_VALUE -gt 240 ]; then new_VALUE=240 fi if [ $(($new_VALUE * 5)) -ne $time ]; then log_warning_msg "$VALUE not possible, using $(($new_VALUE * 5)) seconds" fi VALUE=$new_VALUE elif [ $time -lt 1800 ]; then if [ $time -ne 1260 ]; then log_warning_msg "$VALUE not possible, using 21 minutes" fi VALUE=252 else new_time=$(($time / 1800)) if [ $new_time -gt 11 ]; then new_time=11 fi if [ $((new_time * 1800)) -ne $time ]; then log_warning_msg "$VALUE not possible, using $(($new_time * 30)) minutes" fi VALUE=$((new_time + 240)) fi ;; esac set_option -S$VALUE ;; poweron_standby) eval_value $VALUE -s ;; interrupt_unmask) eval_value $VALUE -u ;; write_cache) eval_value $VALUE -W ;; transfer_mode) set_option -X$VALUE ;; acoustic_management) set_option -M$VALUE ;; keep_settings_over_reset) eval_value $VALUE -k ;; keep_features_over_reset) eval_value $VALUE -K ;; chipset_pio_mode) set_option -p$VALUE ;; security_unlock) set_option --security-unlock $VALUE ;; security_pass) set_option --security-set-pass $VALUE ;; security_disable) set_option --security-disable $VALUE ;; user-master) set_option --user-master $VALUE ;; security_mode) set_option --security-mode $VALUE ;; ROOTFS) ROOTFS=$VALUE ;; *) log_failure_msg "Unknown option $KEY" exit 1 ;; esac ;; "") case $KEY in '}') if [ -z "$DISC" ] && [ "$WAS_RUN" != '1' ]; then log_failure_msg "No disk enabled. Exiting" exit 1 fi if [ -n "$OPTIONS" ] && [ -b "$DISC" ]; then if [ -n "$ROOTFS" ]; then if [ "$FIRST" = 'yes' ] && [ "$DISC" != "$ROOTFS" ]; then continue fi if [ "$FIRST" = 'no' ] && [ "$DISC" = "$ROOTFS" ]; then continue fi fi ret=0 if [ "$UDEV" = 'yes' ] && [ "$IN_BLOCK" = 1 ]; then # Flush the drive's internal write cache to the disk. /sbin/hdparm -q -f $DISC 2>/dev/null || ret=$? /sbin/hdparm $OPTIONS $DISC 2>/dev/null || ret=$? if [ "$VERBOSE" = 'yes' ]; then log_progress_msg " $DISC" log_end_msg $ret || true fi elif [ "$UDEV" = 'no' ]; then /sbin/hdparm -q -f $DISC 2>/dev/null || ret=$? /sbin/hdparm $OPTIONS $DISC 2>/dev/null || ret=$? WAS_RUN=1 log_progress_msg " $DISC" log_end_msg $ret || true fi fi ;; quiet) if [ -n "$DISC" ]; then OPT_QUIET=-q else DEF_QUIET=-q fi ;; standby) set_option -y ;; sleep) set_option -Y ;; disable_seagate) set_option -Z ;; security_freeze) set_option --security-freeze ;; *) log_failure_msg "unknown option $KEY" exit 1 ;; esac ;; *) log_failure_msg "unknown separator $SEP" exit 1 ;; esac else $KEY $SEP $VALUE NEXT_LINE=no-go WAS_RUN=1 fi done if [ -n "$harddisks" ] && [ -n "$hdparm_opts" ] && [ "$UDEV" = 'no' ]; then ret=0 for drive in $harddisks; do WAS_RUN=1 log_progress_msg "$drive " /sbin/hdparm -q -f $drive 2>/dev/null|| ret=$? /sbin/hdparm -q $hdparm_opts -q $drive 2>/dev/null|| ret=$? done log_end_msg $ret || true fi if [ "$UDEV" = 'no' -a "$WAS_RUN" = 0 ]; then log_progress_msg "(none)" log_end_msg 0 fi } exit 0 stop-bootlogd-single000066600000002167150770332110010553 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: stop-bootlogd-single # Required-Start: $local_fs $all # Required-Stop: # Default-Start: S # Default-Stop: # Short-Description: Stop bootlogd in single user mode # Description: See the init.d/bootlogd script ### END INIT INFO # # This has to run in the boot sequence (rcS.d), and not in the "single # user" sequence (rc1.d), because rc1.d/ is not used when booting into # single user. "grep :[S1]: /etc/inittab" show that single user is just # a call to /sbin/sulogin, while runlevel 1 is a call to # "/etc/init.d/rc 1" which in the end switches to runlevel S to run # /sbin/sulogin. PATH=/sbin:/usr/sbin:/bin:/usr/bin NAME=stop-bootlogd-single DAEMON=/sbin/bootlogd [ -x "$DAEMON" ] || exit 0 case "$1" in start) single=false for word in $(cat /proc/cmdline); do case "$word" in S|single|1) single=true ;; esac done if [ true = "$single" ] ; then /etc/init.d/bootlogd stop fi ;; stop|restart|force-reload) # No-op ;; status) exec /etc/init.d/bootlogd status ;; *) echo "Usage: $NAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac : mountall-bootclean.sh000066600000001154150770332110010703 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: mountall-bootclean # Required-Start: mountall # Required-Stop: # Default-Start: S # Default-Stop: # Short-Description: bootclean after mountall. # Description: Clean temporary filesystems after # all local filesystems have been mounted. ### END INIT INFO case "$1" in start|"") # Clean /tmp, /var/lock, /var/run . /lib/init/bootclean.sh ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; *) echo "Usage: mountall-bootclean.sh [start|stop]" >&2 exit 3 ;; esac : mountdevsubfs.sh000066600000003030150770332110010003 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: mountdevsubfs # Required-Start: mountkernfs # Required-Stop: # Should-Start: udev # Default-Start: S # Default-Stop: # Short-Description: Mount special file systems under /dev. # Description: Mount the virtual filesystems the kernel provides # that ordinarily live under the /dev filesystem. ### END INIT INFO # # This script gets called multiple times during boot # PATH=/sbin:/bin TTYGRP=5 TTYMODE=620 [ -f /etc/default/devpts ] && . /etc/default/devpts TMPFS_SIZE= [ -f /etc/default/tmpfs ] && . /etc/default/tmpfs KERNEL="$(uname -s)" . /lib/lsb/init-functions . /lib/init/mount-functions.sh do_start () { # # Mount a tmpfs on /dev/shm # if [ ! -d /dev/shm ] then mkdir --mode=755 /dev/shm [ -x /sbin/restorecon ] && /sbin/restorecon /dev/shm fi SHM_OPT= [ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=",size=$SHM_SIZE" domount tmpfs shmfs /dev/shm tmpfs -onosuid,nodev$SHM_OPT # # Mount /dev/pts # if [ "$KERNEL" = Linux ] then if [ ! -d /dev/pts ] then mkdir --mode=755 /dev/pts [ -x /sbin/restorecon ] && /sbin/restorecon /dev/pts fi domount devpts "" /dev/pts devpts -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE fi } case "$1" in "") echo "Warning: mountdevsubfs should be called with the 'start' argument." >&2 do_start ;; start) do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; *) echo "Usage: mountdevsubfs [start|stop]" >&2 exit 3 ;; esac mysql000066600000012475150770332110005650 0ustar00#!/bin/bash # ### BEGIN INIT INFO # Provides: mysql # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Should-Start: $network $time # Should-Stop: $network $time # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start and stop the mysql database server daemon # Description: Controls the main MySQL database server daemon "mysqld" # and its wrapper script "mysqld_safe". ### END INIT INFO # set -e set -u ${DEBIAN_SCRIPT_DEBUG:+ set -v -x} test -x /usr/bin/mysqld_safe || exit 0 . /lib/lsb/init-functions SELF=$(cd $(dirname $0); pwd -P)/$(basename $0) CONF=/etc/mysql/my.cnf MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" # priority can be overriden and "-s" adds output to stderr ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i" # 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 mysqld_get_param option mysqld_get_param() { /usr/sbin/mysqld --print-defaults \ | tr " " "\n" \ | grep -- "--$1" \ | tail -n 1 \ | cut -d= -f2 } ## Do some sanity checks before even trying to start mysqld. 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=`mysqld_get_param datadir` if LC_ALL=C BLOCKSIZE= df --portability $datadir/. | tail -n 1 | awk '{ exit ($4>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 mysqld in the process list # # Usage: boolean mysqld_status [check_alive|check_dead] [warn|nowarn] mysqld_status () { ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? )) ps_alive=0 pidfile=`mysqld_get_param pid-file` if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi 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 MySQL database server" "mysqld" if mysqld_status check_alive nowarn; then log_progress_msg "already running" log_end_msg 0 else # Could be removed during boot test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld # Start MySQL! /usr/bin/mysqld_safe > /dev/null 2>&1 & # 6s was reported in #352070 to be too few when using ndbcluster for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do sleep 1 if mysqld_status check_alive nowarn ; then break; fi log_progress_msg "." done if mysqld_status check_alive warn; then log_end_msg 0 # Now start mysqlcheck or whatever the admin wants. output=$(/etc/mysql/debian-start) [ -n "$output" ] && log_action_msg "$output" else 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 MySQL database server" "mysqld" if ! mysqld_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 MySQL database server by signal" "mysqld" killall -15 mysqld server_down= for i in 1 2 3 4 5 6 7 8 9 10; do sleep 1 if mysqld_status check_dead nowarn; then server_down=1; break; fi done if test -z "$server_down"; then killall -9 mysqld; fi fi fi if ! mysqld_status check_dead warn; then log_end_msg 1 log_failure_msg "Please stop MySQL manually and read /usr/share/doc/mysql-server-5.1/README.Debian.gz!" exit -1 else log_end_msg 0 fi ;; 'restart') set +e; $SELF stop; set -e $SELF start ;; 'reload'|'force-reload') log_daemon_msg "Reloading MySQL database server" "mysqld" $MYADMIN reload log_end_msg 0 ;; 'status') if mysqld_status check_alive nowarn; then log_action_msg "$($MYADMIN version)" else log_action_msg "MySQL is stopped." exit 3 fi ;; *) echo "Usage: $SELF start|stop|restart|reload|force-reload|status" exit 1 ;; esac hostname.sh000066600000002617150770332110006727 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: hostname # Required-Start: # Required-Stop: # Should-Start: glibc # Default-Start: S # Default-Stop: # Short-Description: Set hostname based on /etc/hostname # Description: Read the machines hostname from /etc/hostname, and # update the kernel value with this value. If # /etc/hostname is empty, the current kernel value # for hostname is used. If the kernel value is # empty, the value 'localhost' is used. ### END INIT INFO PATH=/sbin:/bin . /lib/init/vars.sh . /lib/lsb/init-functions do_start () { [ -f /etc/hostname ] && HOSTNAME="$(cat /etc/hostname)" # Keep current name if /etc/hostname is missing. [ -z "$HOSTNAME" ] && HOSTNAME="$(hostname)" # And set it to 'localhost' if no setting was found [ -z "$HOSTNAME" ] && HOSTNAME=localhost [ "$VERBOSE" != no ] && log_action_begin_msg "Setting hostname to '$HOSTNAME'" hostname "$HOSTNAME" ES=$? [ "$VERBOSE" != no ] && log_action_end_msg $ES exit $ES } do_status () { HOSTNAME=$(hostname) if [ "$HOSTNAME" ] ; then return 0 else return 4 fi } case "$1" in start|"") do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; status) do_status exit $? ;; *) echo "Usage: hostname.sh [start|stop]" >&2 exit 3 ;; esac : urandom000066600000003701150770332110006140 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: urandom # Required-Start: $local_fs # Required-Stop: $local_fs # Default-Start: S # Default-Stop: 0 6 # Short-Description: Save and restore random seed between restarts. # Description: This script saves the random seed between restarts. # It is called from the boot, halt and reboot scripts. ### END INIT INFO [ -c /dev/urandom ] || exit 0 PATH=/sbin:/bin SAVEDFILE=/var/lib/urandom/random-seed POOLSIZE=512 [ -f /proc/sys/kernel/random/poolsize ] && POOLSIZE="$(cat /proc/sys/kernel/random/poolsize)" . /lib/init/vars.sh . /lib/lsb/init-functions do_status () { if [ -f $SAVEDFILE ] ; then return 0 else return 4 fi } case "$1" in start|"") [ "$VERBOSE" = no ] || log_action_begin_msg "Initializing random number generator" # Load and then save $POOLSIZE bytes, # which is the size of the entropy pool if [ -f "$SAVEDFILE" ] then # Handle locally increased pool size set -- $(LC_ALL=C ls -l "$SAVEDFILE") SAVEDSIZE="$5" if [ "$SAVEDSIZE" -gt "$POOLSIZE" ] then [ -w /proc/sys/kernel/random/poolsize ] && echo $POOLSIZE > /proc/sys/kernel/random/poolsize POOLSIZE=$SAVEDSIZE fi cat "$SAVEDFILE" >/dev/urandom fi rm -f $SAVEDFILE # Hm, why is the saved pool re-created at boot? [pere 2009-09-03] umask 077 dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1 ES=$? umask 022 [ "$VERBOSE" = no ] || log_action_end_msg $ES ;; stop) # Carry a random seed from shut-down to start-up; # see documentation in linux/drivers/char/random.c [ "$VERBOSE" = no ] || log_action_begin_msg "Saving random seed" umask 077 dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1 ES=$? [ "$VERBOSE" = no ] || log_action_end_msg $ES ;; status) do_status exit $? ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; *) echo "Usage: urandom start|stop" >&2 exit 3 ;; esac : ifupdown000066600000004726150770332110006336 0ustar00#!/bin/sh -e ### BEGIN INIT INFO # Provides: ifupdown # Required-Start: ifupdown-clean # Required-Stop: $local_fs # Default-Start: S # Default-Stop: 0 6 # Short-Description: Prepare the system for taking up interfaces. ### END INIT INFO [ -x /sbin/ifup ] || exit 0 [ -x /sbin/ifdown ] || exit 0 . /lib/lsb/init-functions MYNAME="${0##*/}" report() { echo "${MYNAME}: $*" ; } report_err() { log_failure_msg "$*" ; } RUN_DIR=/etc/network/run [ -r /etc/default/ifupdown ] && . /etc/default/ifupdown # Note: The state file location is hardcoded in ifup|ifdown IFSTATE=/etc/network/run/ifstate myreadlink () { dest="${1%/}" extras="" while [ "$dest" != "" ]; do if [ -d "$dest" ]; then cd "$dest" dest=$(/bin/pwd) break fi if [ -L "$dest" ]; then d2=$(readlink "$dest") if [ "${d2#/}" = "$d2" ]; then dest="${dest%/*}/$d2" else dest="$d2" fi fi while [ ! -e "$dest" ]; do extras="${dest##*/}/$extras" if [ "${extras%%/*}" = ".." ]; then return 1; fi destx="${dest%/*}" if [ "$destx" = "$dest" ]; then destx=""; fi dest="$destx" done done dest="$dest/$extras" echo "${dest%/}" } case "$1" in start|restart) if [ "$2" ]; then report_err "Arguments to '$1' command not accepted" exit 3 fi log_begin_msg "Setting up networking..." # if /etc/network/run is a symlink to a directory that doesn't exist, # create it. if [ -L "$RUN_DIR" ] && [ ! -d "$RUN_DIR" ] ; then runmkdir="$(myreadlink "$RUN_DIR")" if [ ! "$runmkdir" ] ; then report_err "Cannot create target of /etc/network/run" log_end_msg 1 exit 1 fi if ! mkdir -p "$runmkdir"; then report_err "Failure creating directory $runmkdir" log_end_msg 1 exit 1 fi fi # Create the state file # Doing this also signals that ifupdown is available for use if [ ! -r "$IFSTATE" ]; then if ! : > "$IFSTATE" ; then report_err "Failure initializing $IFSTATE" log_end_msg 1 exit 1 fi fi log_end_msg 0 exit 0 ;; stop) if [ "$2" ]; then report_err "Arguments to '$1' command not accepted" exit 3 fi if [ -x /etc/init.d/ifupdown-clean ]; then /etc/init.d/ifupdown-clean start fi ;; force-reload) ;; *) echo "Usage: $0 {start|stop|restart|force-reload}" >&2 exit 3 ;; esac exit 0 stop-bootlogd000066600000001067150770332110007272 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: stop-bootlogd # Required-Start: $local_fs $all # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Stop bootlogd # Description: See the init.d/bootlogd script ### END INIT INFO NAME=stop-bootlogd DAEMON=/sbin/bootlogd [ -x "$DAEMON" ] || exit 0 case "$1" in start) /etc/init.d/bootlogd stop ;; stop|restart|force-reload) # No-op ;; status) exec /etc/init.d/bootlogd status ;; *) echo "Usage: $NAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac : hwclockfirst.sh000066600000011727150770332110007615 0ustar00#!/bin/sh # hwclock.sh Set and adjust the CMOS clock, according to the UTC # setting in /etc/default/rcS (see also rcS(5)). # # Version: @(#)hwclock.sh 2.00 14-Dec-1998 miquels@cistron.nl # # Patches: # 2000-01-30 Henrique M. Holschuh # - 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. # WARNING: Please read /usr/share/doc/util-linux/README.Debian.hwclock # before changing this file. You risk serious clock # misbehaviour otherwise. ### BEGIN INIT INFO # Provides: hwclockfirst # Required-Start: mountdevsubfs # Required-Stop: # Default-Start: S # X-Start-Before: checkroot # Default-Stop: ### END INIT INFO FIRST=yes # debian/rules sets this to 'yes' when creating hwclockfirst.sh # Set this to any options you might need to give to hwclock, such # as machine hardware clock type for Alphas. HWCLOCKPARS= # Set this to the hardware clock device you want to use, it should # probably match the CONFIG_RTC_HCTOSYS_DEVICE kernel config option. HCTOSYS_DEVICE=rtc0 hwclocksh() { [ ! -x /sbin/hwclock ] && return 0 [ ! -r /etc/default/rcS ] || . /etc/default/rcS . /lib/lsb/init-functions verbose_log_action_msg() { [ "$VERBOSE" = no ] || log_action_msg "$@"; } [ "$GMT" = "-u" ] && UTC="yes" case "$UTC" in no|"") GMT="--localtime" UTC="" if [ "X$FIRST" = "Xyes" ] && [ ! -r /etc/localtime ]; then if [ -z "$TZ" ]; then log_action_msg "System clock was not updated at this time" return 1 fi fi ;; yes) GMT="--utc" UTC="--utc" ;; *) log_action_msg "Unknown UTC setting: \"$UTC\""; return 1 ;; esac case "$BADYEAR" in no|"") BADYEAR="" ;; yes) BADYEAR="--badyear" ;; *) log_action_msg "unknown BADYEAR setting: \"$BADYEAR\""; return 1 ;; esac case "$1" in start) if [ -d /dev/.udev ]; then return 0 fi if [ -w /etc ] && [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; then echo "0.0 0 0.0" > /etc/adjtime fi if [ ! -w /etc/adjtime ]; then NOADJ="--noadjfile" else NOADJ="" fi if [ "$FIRST" != yes ]; then # Uncomment the hwclock --adjust line below if you want # hwclock to try to correct systematic drift errors in the # Hardware Clock. # # WARNING: If you uncomment this option, you must either make # sure *nothing* changes the Hardware Clock other than # hwclock --systohc, or you must delete /etc/adjtime # every time someone else modifies the Hardware Clock. # # Common "vilains" are: ntp, MS Windows, the BIOS Setup # program. # # WARNING: You must remember to invalidate (delete) # /etc/adjtime if you ever need to set the system clock # to a very different value and hwclock --adjust is being # used. # # Please read /usr/share/doc/util-linux/README.Debian.hwclock # before enabling hwclock --adjust. #/sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --adjust $GMT $BADYEAR : fi if [ "$HWCLOCKACCESS" != no ]; then log_action_msg "Setting the system clock" # 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 $GMT $HWCLOCKPARS $BADYEAR $NOADJ; 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 [ ! -w /etc/adjtime ]; then NOADJ="--noadjfile" else NOADJ="" fi if [ "$HWCLOCKACCESS" != no ]; then log_action_msg "Saving the system clock" if [ "$GMT" = "-u" ]; then GMT="--utc" fi if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --systohc $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then verbose_log_action_msg "Hardware Clock updated to `date`" fi else verbose_log_action_msg "Not saving System Clock" fi ;; show) if [ ! -w /etc/adjtime ]; then NOADJ="--noadjfile" else NOADJ="" fi if [ "$HWCLOCKACCESS" != no ]; then /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --show $GMT $HWCLOCKPARS $BADYEAR $NOADJ 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 "$@" bootlogd000066600000004614150770332110006310 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: bootlogd # Required-Start: mountdevsubfs # X-Start-Before: hostname keymap keyboard-setup procps pcmcia hwclock hwclockfirst hdparm hibernate-cleanup lvm2 # Required-Stop: # Default-Start: S # Default-Stop: # Short-Description: Start or stop bootlogd. # Description: Starts or stops the bootlogd log program # which logs boot messages. ### END INIT INFO PATH=/sbin:/bin # No remote fs at start DAEMON=/sbin/bootlogd [ -x "$DAEMON" ] || exit 0 NAME=bootlogd DESC="boot logger" BOOTLOGD_OPTS="-r -c" [ -r /etc/default/bootlogd ] && . /etc/default/bootlogd . /lib/init/vars.sh . /lib/lsb/init-functions # Because bootlogd is broken on some systems, we take the special measure # of requiring it to be enabled by setting an environment variable. case "$BOOTLOGD_ENABLE" in [Nn]*) exit 0 ;; esac # Previously this script was symlinked as "stop-bootlogd" which, when run # with the "start" argument, should stop bootlogd. Now stop-bootlogd is # a distinct script, but for backward compatibility this script continues # to implement the old behavior. SCRIPTNAME=${0##*/} SCRIPTNAME=${SCRIPTNAME#[SK]??} ACTION="$1" case "$0" in *stop-bootlog*) [ "$ACTION" = start ] && ACTION=stop ;; esac case "$ACTION" in start) # PATH is set above [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" if [ -d /proc/1/. ] then umask 027 start-stop-daemon --start --quiet --exec $DAEMON -- \ $BOOTLOGD_OPTS ES=$? else $DAEMON $BOOTLOGD_OPTS ES=$? fi [ "$VERBOSE" != no ] && log_end_msg $ES ;; stop) PATH=/bin:/sbin:/usr/bin:/usr/sbin [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" start-stop-daemon --oknodo --stop --quiet --exec $DAEMON ES=$? sleep 1 [ "$VERBOSE" != no ] && log_end_msg $ES if [ -f /var/log/boot ] && [ -f /var/log/boot~ ] then [ "$VERBOSE" = no ] || log_action_begin_msg "Moving boot log file" # bootlogd writes to boot, making backup at boot~ cd /var/log && { chgrp adm boot || : savelog -q -p -c 5 boot \ && mv boot.0 boot \ && mv boot~ boot.0 } ES=$? [ "$VERBOSE" = no ] || log_action_end_msg $ES fi ;; restart|force-reload) /etc/init.d/bootlogd stop /etc/init.d/bootlogd start ;; status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2 exit 3 ;; esac : killprocs000066600000002415150770332110006476 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: killprocs # Required-Start: $local_fs # Required-Stop: # Default-Start: 1 # Default-Stop: # Short-Description: executed by init(8) upon entering runlevel 1 (single). ### END INIT INFO PATH=/sbin:/usr/sbin:/bin:/usr/bin . /lib/lsb/init-functions do_start () { # Kill all processes. log_action_begin_msg "Asking all remaining processes to terminate" killall5 -15 # SIGTERM log_action_end_msg 0 alldead="" for seq in 1 2 3 4 5 6 7 8 9 10; do # use SIGCONT/signal 18 to check if there are # processes left. No need to check the exit code # value, because either killall5 work and it make # sense to wait for processes to die, or it fail and # there is nothing to wait for. if killall5 -18 ; then : else alldead=1 break fi sleep 1 done if [ -z "$alldead" ] ; then log_action_begin_msg "Killing all remaining processes" killall5 -9 # SIGKILL log_action_end_msg 1 else log_action_begin_msg "All processes ended within $seq seconds." log_action_end_msg 0 fi } case "$1" in start) do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac mountall.sh000066600000003204150770332110006735 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: mountall # Required-Start: checkfs # Required-Stop: # Default-Start: S # Default-Stop: # Short-Description: Mount all filesystems. # Description: ### END INIT INFO PATH=/sbin:/bin . /lib/init/vars.sh . /lib/lsb/init-functions . /lib/init/mount-functions.sh . /lib/init/swap-functions.sh # for ntfs-3g to get correct file name encoding if [ -r /etc/default/locale ]; then . /etc/default/locale export LANG fi do_start() { # # Mount local file systems in /etc/fstab. # mount_all_local() { mount -a -t nonfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs,gfs2 \ -O no_netdev } pre_mountall if [ "$VERBOSE" = no ] then log_action_begin_msg "Mounting local filesystems" mount_all_local log_action_end_msg $? else log_daemon_msg "Will now mount local filesystems" mount_all_local log_end_msg $? fi post_mountall case "$(uname -s)" in *FreeBSD) INITCTL=/etc/.initctl ;; *) INITCTL=/dev/initctl ;; esac # # We might have mounted something over /dev, see if # /dev/initctl is there. Look for /usr/share/sysvinit/update-rc.d # to verify that sysvinit (and not upstart) is installed). # if [ ! -p $INITCTL ] && [ -f /usr/share/sysvinit/update-rc.d ]; then rm -f $INITCTL mknod -m 600 $INITCTL p kill -USR1 1 fi # Execute swapon command again, in case we want to swap to # a file on a now mounted filesystem. swaponagain 'swapfile' } case "$1" in start|"") do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; *) echo "Usage: mountall.sh [start|stop]" >&2 exit 3 ;; esac : rc.local000066600000001441150770332110006167 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: rc.local # Required-Start: $remote_fs $syslog $all # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Run /etc/rc.local if it exist ### END INIT INFO PATH=/sbin:/usr/sbin:/bin:/usr/bin . /lib/init/vars.sh . /lib/lsb/init-functions do_start() { if [ -x /etc/rc.local ]; then [ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)" /etc/rc.local ES=$? [ "$VERBOSE" != no ] && log_end_msg $ES return $ES fi } case "$1" in start) do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac screen-cleanup000066600000002037150770332110007400 0ustar00#!/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 ### END INIT INFO set -e SCREENDIR=/var/run/screen case "$1" in start) if test -L $SCREENDIR || ! test -d $SCREENDIR; then rm -f $SCREENDIR mkdir $SCREENDIR chown root:utmp $SCREENDIR fi find $SCREENDIR -type p -print0 | xargs -0r rm -f -- # 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 0777 $SCREENDIR fi ;; stop|restart|reload|force-reload) ;; esac exit 0 ifupdown-clean000066600000002027150770332110007406 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: ifupdown-clean # Required-Start: checkroot # Required-Stop: # Default-Start: S # Default-Stop: # Short-Description: Clean old interface status info during boot. ### END INIT INFO set -e . /lib/lsb/init-functions MYNAME="${0##*/}" PATH=/sbin:/bin [ -r /etc/default/ifupdown ] && . /etc/default/ifupdown # Note: The state file location is hardcoded in ifup|ifdown # it is used as a variable in this script order to ease transitions # to other locations by the package (not by the sysadmin), if you want # to setup an alternate location please use a symlink IFSTATE=/etc/network/run/ifstate case "$1" in start) log_begin_msg "Cleaning up ifupdown..." if [ -f $IFSTATE -a ! -L $IFSTATE ]; then rm -f "$IFSTATE" elif [ -f $IFSTATE ]; then # This is kinda bad :( >$IFSTATE fi log_end_msg 0 exit 0 ;; stop|restart|force-reload) exit 0 ;; *) echo "Usage: $0 {start|stop|restart|force-reload}" >&2 exit 3 ;; esac mountnfs.sh000066600000004432150770332110006757 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: mountnfs # Required-Start: $local_fs # Required-Stop: # Should-Start: $network $portmap nfs-common udev-mtab # Default-Start: S # Default-Stop: # Short-Description: Wait for network file systems to be mounted # Description: Network file systems are mounted by # /etc/network/if-up.d/mountnfs in the background # when interfaces are brought up; this script waits # for them to be mounted before carrying on. ### END INIT INFO . /lib/init/vars.sh . /lib/lsb/init-functions do_wait_async_mount() { [ -f /etc/fstab ] || return # # Read through fstab line by line. If it is NFS, set the flag # for mounting NFS file systems. If any NFS partition is found # then wait around for it. # exec 9<&0 &2 exit 3 ;; stop) ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac : exit 0 proftpd000066600000011545150770332110006156 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: proftpd # Required-Start: $remote_fs $syslog $local_fs $network # Required-Stop: $remote_fs $syslog $local_fs $network # Should-Start: $named # Should-Stop: $named # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts ProFTPD daemon # Description: This script runs the FTP service offered # by the ProFTPD daemon ### END INIT INFO # Start the proftpd FTP daemon. PATH=/bin:/usr/bin:/sbin:/usr/sbin DAEMON=/usr/sbin/proftpd NAME=proftpd # Defaults RUN="no" OPTIONS="" PIDFILE=`grep -i 'pidfile' /etc/proftpd/proftpd.conf | sed -e 's/pidfile[\t ]\+//i'` if [ "x$PIDFILE" = "x" ]; then PIDFILE=/var/run/proftpd.pid fi # Read config (will override defaults) [ -r /etc/default/proftpd ] && . /etc/default/proftpd trap "" 1 trap "" 15 test -f $DAEMON || exit 0 . /lib/lsb/init-functions # # Servertype could be inetd|standalone|none. # In all cases check against inetd and xinetd support. # if ! egrep -qi "^[[:space:]]*ServerType.*standalone" /etc/proftpd/proftpd.conf then if egrep -qi "server[[:space:]]*=[[:space:]]*/usr/sbin/proftpd" /etc/xinetd.conf 2>/dev/null || \ egrep -qi "server[[:space:]]*=[[:space:]]*/usr/sbin/proftpd" /etc/xinetd.d/* 2>/dev/null || \ egrep -qi "^ftp.*/usr/sbin/proftpd" /etc/inetd.conf 2>/dev/null then RUN="no" INETD="yes" else if ! egrep -qi "^[[:space:]]*ServerType.*inetd" /etc/proftpd/proftpd.conf then RUN="yes" INETD="no" else RUN="no" INETD="no" fi fi fi # /var/run could be on a tmpfs [ ! -d /var/run/proftpd ] && mkdir /var/run/proftpd inetd_check() { if [ ! -x /usr/sbin/inetd -a ! -x /usr/sbin/xinetd ]; then echo "Neither inetd nor xinetd appears installed: check your configuration." fi } start() { log_daemon_msg "Starting ftp server" "$NAME" start-stop-daemon --start --quiet --pidfile "$PIDFILE" --oknodo --exec $DAEMON -- $OPTIONS if [ $? != 0 ]; then log_end_msg 1 exit 1 else log_end_msg 0 fi } signal() { if [ "$1" = "stop" ]; then SIGNAL="TERM" log_daemon_msg "Stopping ftp server" "$NAME" else if [ "$1" = "reload" ]; then SIGNAL="HUP" log_daemon_msg "Reloading ftp server" "$NAME" else echo "ERR: wrong parameter given to signal()" exit 1 fi fi if [ -f "$PIDFILE" ]; then start-stop-daemon --stop --signal $SIGNAL --quiet --pidfile "$PIDFILE" if [ $? = 0 ]; then log_end_msg 0 else SIGNAL="KILL" start-stop-daemon --stop --signal $SIGNAL --quiet --pidfile "$PIDFILE" if [ $? != 0 ]; then log_end_msg 1 [ $2 != 0 ] || exit 0 else log_end_msg 0 fi fi if [ "$SIGNAL" = "KILL" ]; then rm -f "$PIDFILE" fi else log_end_msg 0 fi } case "$1" in start) if [ "x$RUN" = "xyes" ] ; then start else if [ "x$INETD" = "xyes" ] ; then echo "ProFTPd is started from inetd/xinetd." inetd_check else echo "ProFTPd warning: cannot start neither in standalone nor in inetd/xinetd mode. Check your configuration." fi fi ;; force-start) if [ "x$INETD" = "xyes" ] ; then echo "Warning: ProFTPd is started from inetd/xinetd (trying to start anyway)." inetd_check fi start ;; stop) if [ "x$RUN" = "xyes" ] ; then signal stop 0 else if [ "x$INETD" = "xyes" ] ; then echo "ProFTPd is started from inetd/xinetd." inetd_check else echo "ProFTPd warning: cannot start neither in standalone nor in inetd/xinetd mode. Check your configuration." fi fi ;; force-stop) if [ "x$INETD" = "xyes" ] ; then echo "Warning: ProFTPd is started from inetd/xinetd (trying to kill anyway)." inetd_check fi signal stop 0 ;; reload) signal reload 0 ;; force-reload|restart) if [ "x$RUN" = "xyes" ] ; then signal stop 1 sleep 2 start else if [ "x$INETD" = "xyes" ] ; then echo "ProFTPd is started from inetd/xinetd." inetd_check else echo "ProFTPd warning: cannot start neither in standalone nor in inetd/xinetd mode. Check your configuration." fi fi ;; status) if [ "x$INETD" = "xyes" ] ; then echo "ProFTPd is started from inetd/xinetd." inetd_check exit 0 else if [ -f "$PIDFILE" ]; then pid=$(cat $PIDFILE) else pid="x" fi if [ `pidof proftpd|grep "$pid"|wc -l` -ne 0 ] ; then echo "ProFTPd is started in standalone mode, currently running." exit 0 else echo "ProFTPd is started in standalone mode, currently not running." exit 3 fi fi ;; check-config) $DAEMON -t >/dev/null && echo "ProFTPd configuration OK" && exit 0 exit 1 ;; *) echo "Usage: /etc/init.d/$NAME {start|status|force-start|stop|force-stop|reload|restart|force-reload|check-config}" exit 1 ;; esac exit 0 networking000066600000004623150770332110006666 0ustar00#!/bin/sh -e ### BEGIN INIT INFO # Provides: networking # Required-Start: mountkernfs $local_fs # Required-Stop: $local_fs # Should-Start: ifupdown # Should-Stop: ifupdown # Default-Start: S # Default-Stop: 0 6 # Short-Description: Raise network interfaces. ### END INIT INFO PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" [ -x /sbin/ifup ] || exit 0 . /lib/lsb/init-functions process_options() { [ -e /etc/network/options ] || return 0 log_warning_msg "/etc/network/options still exists and it will be IGNORED! Read README.Debian of netbase." } check_network_file_systems() { [ -e /proc/mounts ] || return 0 if [ -e /etc/iscsi/iscsi.initramfs ]; then log_warning_msg "not deconfiguring network interfaces: iSCSI root is mounted." exit 0 fi exec 9<&0 < /proc/mounts while read DEV MTPT FSTYPE REST; do case $DEV in /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*) log_warning_msg "not deconfiguring network interfaces: network devices still mounted." exit 0 ;; esac case $FSTYPE in nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs) log_warning_msg "not deconfiguring network interfaces: network file systems still mounted." exit 0 ;; esac done exec 0<&9 9<&- } check_network_swap() { [ -e /proc/swaps ] || return 0 exec 9<&0 < /proc/swaps while read DEV MTPT FSTYPE REST; do case $DEV in /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*) log_warning_msg "not deconfiguring network interfaces: network swap still mounted." exit 0 ;; esac done exec 0<&9 9<&- } case "$1" in start) process_options log_action_begin_msg "Configuring network interfaces" if ifup -a; then log_action_end_msg $? else log_action_end_msg $? fi ;; stop) check_network_file_systems check_network_swap log_action_begin_msg "Deconfiguring network interfaces" if ifdown -a --exclude=lo; then log_action_end_msg $? else log_action_end_msg $? fi ;; force-reload|restart) process_options log_warning_msg "Running $0 $1 is deprecated because it may not enable again some interfaces" log_action_begin_msg "Reconfiguring network interfaces" ifdown -a --exclude=lo || true if ifup -a --exclude=lo; then log_action_end_msg $? else log_action_end_msg $? fi ;; *) echo "Usage: /etc/init.d/networking {start|stop}" exit 1 ;; esac exit 0 checkroot.sh000066600000025106150770332110007070 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: checkroot # Required-Start: mountdevsubfs hostname # Required-Stop: # Should-Start: keymap hwclockfirst hdparm bootlogd # Should-stop: # Default-Start: S # Default-Stop: # X-Interactive: true # Short-Description: Check to root file system. ### END INIT INFO # Include /usr/bin in path to find on_ac_power if /usr/ is on the root # partition. PATH=/sbin:/bin:/usr/bin FSCK_LOGFILE=/var/log/fsck/checkroot [ "$FSCKFIX" ] || FSCKFIX=no [ "$SULOGIN" ] || SULOGIN=no . /lib/init/vars.sh . /lib/lsb/init-functions . /lib/init/mount-functions.sh . /lib/init/splash-functions-base . /lib/init/usplash-fsck-functions.sh do_start () { # # Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to # be spawned from this script *before anything else* with a timeout, # like sysv does. # [ "$SULOGIN" = yes ] && sulogin -t 30 $CONSOLE KERNEL="$(uname -s)" MACHINE="$(uname -m)" # # Read /etc/fstab, looking for: # 1) The root filesystem, resolving LABEL=*|UUID=* entries to the # device node, # 2) Swap that is on a md device or a file that may be on a md # device, # exec 9<&0 /dev/null 2>&1 log_action_end_msg $? else log_daemon_msg "Activating swap" swapon -a -v log_end_msg $? fi fi # # Does the root device in /etc/fstab match with the actual device ? # If not we try to use the /dev/root alias device, and if that # fails we create a temporary node in /lib/init/rw. # if [ "$rootcheck" = yes ] then ddev="$(mountpoint -qx $rootdev)" rdev="$(mountpoint -d /)" if [ "$ddev" != "$rdev" ] && [ "$ddev" != "4:0" ] then if [ "$(mountpoint -qx /dev/root)" = "4:0" ] then rootdev=/dev/root else if \ rm -f /lib/init/rw/rootdev \ && mknod -m 600 /lib/init/rw/rootdev b ${rdev%:*} ${rdev#*:} \ && [ -e /lib/init/rw/rootdev ] then rootdev=/lib/init/rw/rootdev else rootfatal=yes fi fi fi fi # # Bother, said Pooh. # if [ "$rootfatal" = yes ] then log_failure_msg "The device node $rootdev for the root filesystem is missing or incorrect or there is no entry for the root filesystem listed in /etc/fstab. The system is also unable to create a temporary node in /lib/init/rw. This means you have to fix the problem manually." log_warning_msg "A maintenance shell will now be started. CONTROL-D will terminate this shell and restart the system." # Start a single user shell on the console if ! sulogin $CONSOLE then log_failure_msg "Attempt to start maintenance shell failed. Will restart in 5 seconds." sleep 5 fi [ "$VERBOSE" = no ] || log_action_msg "Will now restart" reboot -f fi # See if we're on AC Power. If not, we're not gonna run our # check. If on_ac_power (in /usr/) is unavailable, behave as # before and check all file systems needing it. # Disabled AC power check until fsck can be told to only check the # file system if it is corrupt when running on battery. (bug #526398) # if which on_ac_power >/dev/null 2>&1 && [ "$rootcheck" = yes ] # then # on_ac_power >/dev/null 2>&1 # if [ "$?" -eq 1 ] # then # log_warning_msg "On battery power, so skipping file system check." # rootcheck=no # fi # fi # # See if we want to check the root file system. # FSCKCODE=0 if [ -f /fastboot ] || grep -s -w -i "fastboot" /proc/cmdline then [ "$rootcheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping root file system check." rootcheck=no fi if [ "$rootcheck" = yes ] then # # Ensure that root is quiescent and read-only before fsck'ing. # # mount -n -o remount,ro / would be the correct syntax but # mount can get confused when there is a "bind" mount defined # in fstab that bind-mounts "/" somewhere else. # # So we use mount -n -o remount,ro $rootdev / but that can # fail on older kernels on sparc64/alpha architectures due # to a bug in sys_mount(). # # As a compromise we try both. # if \ ! mount -n -o remount,ro $rootdev / \ && ! mount -n -o remount,ro -t dummytype $rootdev / 2>/dev/null \ && ! mount -n -o remount,ro / 2>/dev/null then log_failure_msg "Cannot check root file system because it is not mounted read-only." rootcheck=no fi fi # # The actual checking is done here. # if [ "$rootcheck" = yes ] then if [ -f /forcefsck ] || grep -s -w -i "forcefsck" /proc/cmdline then force="-f" else force="" fi if [ "$FSCKFIX" = yes ] then fix="-y" else fix="-a" fi spinner="-C" case "$TERM" in dumb|network|unknown|"") spinner="" ;; esac # This Linux/s390 special case should go away. if [ "${KERNEL}:${MACHINE}" = Linux:s390 ] then spinner="" fi if [ "$VERBOSE" = no ] then log_action_begin_msg "Checking root file system" if [ "$roottype" = "ext2" -o "$roottype" = "ext3" -o "$roottype" = "ext4" ] && usplash_running; then PROGRESS_FILE=`mktemp -p /lib/init/rw` || PROGRESS_FILE=/lib/init/rw/checkroot_fsck set -m logsave -s $FSCK_LOGFILE fsck -C3 $force $fix -t $roottype $rootdev >/dev/console 2>&1 3>$PROGRESS_FILE & set +m usplash_progress "$PROGRESS_FILE" rm -f $PROGRESS_FILE else splash_start_indefinite logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -t $roottype $rootdev FSCKCODE=$? splash_stop_indefinite fi if [ "$FSCKCODE" = 0 ] then log_action_end_msg 0 else log_action_end_msg 1 "code $FSCKCODE" fi else splash_start_indefinite log_daemon_msg "Will now check root file system" logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -V -t $roottype $rootdev FSCKCODE=$? log_end_msg $FSCKCODE splash_stop_indefinite fi fi # # If there was a failure, drop into single-user mode. # # NOTE: "failure" is defined as exiting with a return code of # 4 or larger. A return code of 1 indicates that file system # errors were corrected but that the boot may proceed. A return # code of 2 or 3 indicates that the system should immediately reboot. # if [ "$FSCKCODE" -gt 3 ] then # Surprise! Re-directing from a HERE document (as in "cat << EOF") # does not work because the root is currently read-only. log_failure_msg "An automatic file system check (fsck) of the root filesystem failed. A manual fsck must be performed, then the system restarted. The fsck should be performed in maintenance mode with the root filesystem mounted in read-only mode." log_warning_msg "The root filesystem is currently mounted in read-only mode. A maintenance shell will now be started. After performing system maintenance, press CONTROL-D to terminate the maintenance shell and restart the system." # Start a single user shell on the console if ! sulogin $CONSOLE then log_failure_msg "Attempt to start maintenance shell failed. Will restart in 5 seconds." sleep 5 fi [ "$VERBOSE" = no ] || log_action_msg "Will now restart" reboot -f elif [ "$FSCKCODE" -gt 1 ] then log_failure_msg "The file system check corrected errors on the root partition but requested that the system be restarted." log_warning_msg "The system will be restarted in 5 seconds." sleep 5 [ "$VERBOSE" = no ] || log_action_msg "Will now restart" reboot -f fi # # Remount root to final mode (rw or ro). # # See the comments above at the previous "mount -o remount" # for an explanation why we try this twice. # if ! mount -n -o remount,$rootopts,$rootmode $fstabroot / 2>/dev/null then mount -n -o remount,$rootopts,$rootmode / fi # # We only create/modify /etc/mtab if the location where it is # stored is writable. If /etc/mtab is a symlink into /proc/ # then it is not writable. # INIT_MTAB_FILE=no MTAB_PATH="$(readlink -f /etc/mtab || :)" case "$MTAB_PATH" in /proc/*) ;; /*) if touch "$MTAB_PATH" >/dev/null 2>&1 then :> "$MTAB_PATH" rm -f ${MTAB_PATH}~ INIT_MTAB_FILE=yes fi ;; "") [ -L /etc/mtab ] && MTAB_PATH="$(readlink /etc/mtab)" if [ "$MTAB_PATH" ] then log_failure_msg "Cannot initialize ${MTAB_PATH}." else log_failure_msg "Cannot initialize /etc/mtab." fi ;; *) log_failure_msg "Illegal mtab location '${MTAB_PATH}'." ;; esac if [ "$INIT_MTAB_FILE" = yes ] then [ "$roottype" != none ] && mount -f -o $rootopts -t $roottype $fstabroot / fi # # Remove /lib/init/rw/rootdev if we created it. # rm -f /lib/init/rw/rootdev } do_status () { # If / is read-write or swap is enabled, this script have done # its job. rootrw=false swapon=false if [ -f /etc/mtab ] ; then if grep " / " /etc/mtab |grep -q rw ; then rootrw=true fi fi if [ -f /proc/swaps ] ; then if [ "$(cat /proc/swaps |grep -v ^Filename)" ] ; then swapon=true fi fi if [ true = "$rootrw" ] || [ true = "$swapon" ] ; then return 0 else return 4 fi } case "$1" in start|"") do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; status) do_status exit $? ;; *) echo "Usage: checkroot.sh [start|stop]" >&2 exit 3 ;; esac : portmap000066600000004220150770332110006152 0ustar00#!/bin/sh # # start/stop portmap daemon. ### BEGIN INIT INFO # Provides: portmap # Required-Start: $network $local_fs # Required-Stop: $network $local_fs # Default-Start: S 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: The RPC portmapper # Description: Portmap is a server that converts RPC (Remote # Procedure Call) program numbers into DARPA # protocol port numbers. It must be running in # order to make RPC calls. Services that use # RPC include NFS and NIS. ### END INIT INFO test -f /sbin/portmap || exit 0 . /lib/lsb/init-functions OPTIONS="" if [ -f /etc/default/portmap ]; then . /etc/default/portmap elif [ -f /etc/portmap.conf ]; then . /etc/portmap.conf fi case "$1" in start) log_begin_msg "Starting portmap daemon..." pid=$( pidofproc -p /var/run/portmap.pid /sbin/portmap ) if [ -n "$pid" ] ; then log_begin_msg "Already running." log_end_msg 0 exit 0 fi start-stop-daemon --start --quiet --oknodo --exec /sbin/portmap -- $OPTIONS log_end_msg $? if [ -f /var/run/portmap.upgrade-state ]; then log_begin_msg "Restoring old RPC service information..." sleep 1 # needs a short pause or pmap_set won't work. :( pmap_set /var/run/portmap.state start-stop-daemon --stop --quiet --oknodo --exec /sbin/portmap log_end_msg $? ;; force-reload) $0 restart ;; restart) $0 stop $0 start ;; status) status_of_proc -p /var/run/portmap.pid /sbin/portmap portmap && exit 0 || exit $? ;; *) log_success_msg "Usage: /etc/init.d/portmap {start|stop|force-reload|restart|status}" exit 1 ;; esac exit 0 exim4000066600000014451150770332110005525 0ustar00#! /bin/sh # /etc/init.d/exim4 # # Written by Miquel van Smoorenburg . # Modified for Debian GNU/Linux by Ian Murdock . # Modified for exim by Tim Cutts # Modified for exim4 by Andreas Metzler # and Marc Haber ### BEGIN INIT INFO # Provides: exim4 # Required-Start: $remote_fs $syslog $named $network $time # Required-Stop: $remote_fs $syslog $named $network # Should-Start: postgresql mysql clamav-daemon greylist spamassassin # Should-Stop: postgresql mysql clamav-daemon greylist spamassassin # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: exim Mail Transport Agent # Description: exim is a Mail Transport agent ### END INIT INFO set -e test -x /usr/lib/exim4/exim4 || exit 0 . /lib/lsb/init-functions if [ -n "$EX4DEBUG" ]; then echo "now debugging $0 $@" set -x fi LANG=C export LANG #read default file QUEUERUNNER='combined' QUEUEINTERVAL='30m' UPEX4OPTS='' PIDFILE="/var/run/exim4/exim.pid" QRPIDFILE="/var/run/exim4/eximqr.pid" [ -f /etc/default/exim4 ] && . /etc/default/exim4 upex4conf() { UPEX4CONF="update-exim4.conf" OLDIFS="$IFS" IFS=: for p in $PATH; do if [ -x "$p/$UPEX4CONF" ]; then IFS="$OLDIFS" $p/$UPEX4CONF $UPEX4OPTS return 0 fi done IFS="$OLDIFS" } # Exit if exim runs from /etc/inetd.conf if [ -f /etc/inetd.conf ] && grep -E -q '^[[:space:]]*((\*|[[:alnum:].-]+):)?smtp[[:space:]]' /etc/inetd.conf then upex4conf exit 0 fi DAEMON="/usr/sbin/exim4" NAME="exim4" # this is from madduck on IRC, 2006-07-06 # There should be a better possibility to give daemon error messages # and/or to log things log() { case "$1" in [[:digit:]]*) success=$1; shift;; *) :;; esac log_action_begin_msg "$1"; shift log_action_end_msg ${success:-0} "$*" } start_exim() { [ -e /var/run/exim4 ] || \ install -d -oDebian-exim -gDebian-exim -m750 /var/run/exim4 case ${QUEUERUNNER} in combined) start_daemon -p "$PIDFILE" \ "$DAEMON" -bd "-q${QFLAGS}${QUEUEINTERVAL}" \ ${COMMONOPTIONS} \ ${QUEUERUNNEROPTIONS} \ ${SMTPLISTENEROPTIONS} log_progress_msg "exim4" ;; separate) start_daemon -p "$PIDFILE" \ "$DAEMON" -bd \ ${COMMONOPTIONS} \ ${SMTPLISTENEROPTIONS} log_progress_msg "exim4_listener" start_daemon -p "$QRPIDFILE" \ "$DAEMON" -oP $QRPIDFILE \ "-q${QFLAGS}${QUEUEINTERVAL}" \ ${COMMONOPTIONS} \ ${QUEUERUNNEROPTIONS} log_progress_msg "exim4_queuerunner" ;; queueonly) start_daemon -p "$QRPIDFILE" \ "$DAEMON" -oP $QRPIDFILE \ "-q${QFLAGS}${QUEUEINTERVAL}" \ ${COMMONOPTIONS} \ ${QUEUERUNNEROPTIONS} log_progress_msg "exim4_queuerunner" ;; no|ppp) start_daemon -p "$PIDFILE" \ "$DAEMON" -bd \ ${COMMONOPTIONS} \ ${SMTPLISTENEROPTIONS} log_progress_msg "exim4_listener" ;; nodaemon) ;; esac } stop_exim() { # we try to kill eximqr and exim SMTP listener, no matter what # ${QUEUERUNNER} is set to, we could have switched since starting. if [ -f "$QRPIDFILE" ]; then killproc -p "$QRPIDFILE" "$DAEMON" log_progress_msg "exim4_queuerunner" fi if [ -f "$PIDFILE" ]; then killproc -p "$PIDFILE" "$DAEMON" log_progress_msg "exim4_listener" fi } reload_exim() { case ${QUEUERUNNER} in combined|no|ppp) killproc -p "$PIDFILE" "$DAEMON" -HUP log_progress_msg "exim4" ;; separate) killproc -p "$PIDFILE" "$DAEMON" -HUP log_progress_msg "exim4_listener" killproc -p "$QRPIDFILE" "$DAEMON" -HUP log_progress_msg "exim4_queuerunner" ;; esac } kill_all_exims() { SIG="${1:-TERM}" for pid in $(pidof $NAME); do if [ "$(readlink /proc/$pid/root)" = "/" ]; then kill -$SIG $pid fi done } status() { # the exit value of this function reflects the status of the SMTP # service. Output shows the status of the queue runner as well. SMTPNAME="SMTP listener daemon" QRNAME="separate queue runner daemon" if [ "${QUEUERUNNER}" = "combined" ]; then SMTPNAME="combined SMTP listener and queue runner daemon" fi log_action_begin_msg "checking $QRNAME" if pidofproc -p "$QRPIDFILE" >/dev/null; then log_action_end_msg 0 "running" else if [ -e "$QRPIDFILE" ]; then log_action_end_msg 1 "$QRNAME failed" else log_action_end_msg 0 "not running" fi fi log_action_begin_msg "checking $SMTPNAME" if pidofproc -p "$PIDFILE" >/dev/null; then log_action_end_msg 0 "running" exit 0 else if [ -e "$PIDFILE" ]; then log_action_end_msg 1 "$SMTPNAME failed" exit 1 else log_action_end_msg 0 "not running" exit 3 fi fi } # check for valid configuration file isconfigvalid() { if ! $DAEMON -bV > /dev/null ; then log 1 "Warning! Invalid configuration file for $NAME. Exiting." exit 1 fi } # check for non-empty paniclog warn_paniclog() { if [ -s "/var/log/exim4/paniclog" ]; then if [ -z "$E4BCD_PANICLOG_NOISE" ] || grep -vq "$E4BCD_PANICLOG_NOISE" /var/log/exim4/paniclog; then log_failure_msg "ALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken" fi fi } case "$1" in start) log_daemon_msg "Starting MTA" # regenerate exim4.conf upex4conf isconfigvalid start_exim log_end_msg 0 warn_paniclog ;; stop) log_daemon_msg "Stopping MTA" stop_exim log_end_msg 0 warn_paniclog ;; restart) log_daemon_msg "Stopping MTA for restart" # regenerate exim4.conf upex4conf isconfigvalid stop_exim log_end_msg 0 sleep 2 log_daemon_msg "Restarting MTA" start_exim log_end_msg 0 warn_paniclog ;; reload|force-reload) log_daemon_msg "Reloading $NAME configuration files" # regenerate exim4.conf upex4conf isconfigvalid reload_exim log_end_msg 0 warn_paniclog ;; status) status ;; what) exiwhat ;; force-stop) kill_all_exims $2 ;; *) echo "Usage: $0 {start|stop|restart|reload|status|what|force-stop}" exit 1 ;; esac exit 0 # vim:tabstop=2:expandtab:shiftwidth=2 bootmisc.sh000066600000002545150770332110006730 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: bootmisc # Required-Start: $remote_fs # Required-Stop: # Should-Start: udev # Default-Start: S # Default-Stop: # Short-Description: Miscellaneous things to be done during bootup. # Description: Some cleanup. Note, it need to run after mountnfs-bootclean.sh. ### END INIT INFO PATH=/sbin:/usr/sbin:/bin:/usr/bin [ "$DELAYLOGIN" ] || DELAYLOGIN=yes . /lib/init/vars.sh do_start () { # # If login delaying is enabled then create the flag file # which prevents logins before startup is complete # case "$DELAYLOGIN" in Y*|y*) echo "System bootup in progress - please wait" > /var/lib/initscripts/nologin ;; esac # Create /var/run/utmp so we can login. : > /var/run/utmp if grep -q ^utmp: /etc/group then chmod 664 /var/run/utmp chgrp utmp /var/run/utmp fi # Set pseudo-terminal access permissions. if [ ! -e /dev/.udev ] && [ -c /dev/ttyp0 ] then chmod -f 666 /dev/tty[p-za-e][0-9a-f] chown -f root:tty /dev/tty[p-za-e][0-9a-f] fi # Remove bootclean's flag files. # Don't run bootclean again after this! rm -f /tmp/.clean /var/run/.clean /var/lock/.clean } case "$1" in start|"") do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; *) echo "Usage: bootmisc.sh [start|stop]" >&2 exit 3 ;; esac : dhcpv6_hack.sh000066600000001250150770332110007261 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: dhcpv6_hack # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 6 # Short-Description: dhcp v6 key creation. # Description: Create dhcp v6 key. ### END INIT INFO DHCP6CCTLKEY=/etc/wide-dhcpv6/dhcp6cctlkey case "$1" in start|"") # The key mustn\'t be world readable umask 066 echo "Generating ${DHCP6CCTLKEY}..." >&2 dd if=/dev/random bs=32 count=1 2>/dev/null | uuencode -m ${DHCP6CCTLKEY} | head -n 2 | tail -n 1 > ${DHCP6CCTLKEY} umask 022 /usr/sbin/update-rc.d dhcpv6_hack.sh remove >/dev/null 2>&1 ;; *) echo "Usage: dhcpv6_hack [start]" >&2 exit 3 ;; esac : umountnfs.sh000066600000004137150770332110007146 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: umountnfs # Required-Start: # Required-Stop: umountfs # Should-Stop: $network $portmap nfs-common # Default-Start: # Default-Stop: 0 6 # Short-Description: Unmount all network filesystems except the root fs. # Description: Also unmounts all virtual filesystems (proc, # devpts, usbfs, sysfs) that are not mounted at the # top level. ### END INIT INFO PATH=/sbin:/usr/sbin:/bin:/usr/bin KERNEL="$(uname -s)" RELEASE="$(uname -r)" . /lib/init/vars.sh . /lib/lsb/init-functions case "${KERNEL}:${RELEASE}" in Linux:[01].*|Linux:2.[01].*) FLAGS="" ;; Linux:2.[23].*|Linux:2.4.?|Linux:2.4.?-*|Linux:2.4.10|Linux:2.4.10-*) FLAGS="-f" ;; *) FLAGS="-f -l" ;; esac do_stop () { # Write a reboot record to /var/log/wtmp before unmounting halt -w # Remove bootclean flag files (precaution against symlink attacks) rm -f /tmp/.clean /var/lock/.clean /var/run/.clean # # Make list of points to unmount in reverse order of their creation # exec 9<&0 &2 exit 3 ;; stop|"") do_stop ;; *) echo "Usage: umountnfs.sh [start|stop]" >&2 exit 3 ;; esac : umountroot000066600000002660150770332110006731 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: umountroot # Required-Start: # Required-Stop: # Should-Stop: halt reboot kexec # Default-Start: # Default-Stop: 0 6 # Short-Description: Mount the root filesystem read-only. ### END INIT INFO PATH=/sbin:/bin . /lib/init/vars.sh . /lib/lsb/init-functions do_stop () { [ "$VERBOSE" = no ] || log_action_begin_msg "Mounting root filesystem read-only" # These directories must exist on the root filesystem as they are # targets for system mountpoints. We've just unmounted all other # filesystems, so either they are mounted now (in which case the # mount point exists) or we can make the mountpoint. for dir in /proc /sys /var/run /var/lock; do mkdir -p $dir || true done MOUNT_FORCE_OPT= [ "$(uname -s)" = "GNU/kFreeBSD" ] && MOUNT_FORCE_OPT=-f # This: # mount -n -o remount,ro / # will act on a bind mount of / if there is one. # See #339023 and the comment in checkroot.sh mount $MOUNT_FORCE_OPT -n -o remount,ro -t dummytype dummydev / 2>/dev/null \ || mount $MOUNT_FORCE_OPT -n -o remount,ro dummydev / 2>/dev/null \ || mount $MOUNT_FORCE_OPT -n -o remount,ro / ES=$? [ "$VERBOSE" = no ] || log_action_end_msg $ES } case "$1" in start) # No-op ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) do_stop ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac : rcS000066600000000165150770332110005223 0ustar00#! /bin/sh # # rcS # # Call all S??* scripts in /etc/rcS.d/ in numerical/alphabetical order # exec /etc/init.d/rc S skeleton000066600000010320150770332110006312 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: skeleton # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Example initscript # Description: This file should be used to construct scripts to be # placed in /etc/init.d. ### END INIT INFO # Author: Foo Bar # # Please remove the "Author" lines above and replace them # with your own name if you copy and modify this script. # 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="Description of the service" NAME=daemonexecutablename DAEMON=/usr/sbin/$NAME DAEMON_ARGS="--options args" PIDFILE=/var/run/$NAME.pid 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.2-14) to ensure that this file is present # and status_of_proc is working. . /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 \ || 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=TERM/30/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/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 1 --quiet --pidfile $PIDFILE --name $NAME return 0 } 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 "$DAEMON" "$NAME" && exit 0 || exit $? ;; #reload|force-reload) # # If do_reload() is not implemented then leave this commented out # and leave 'force-reload' as an alias for 'restart'. # #log_daemon_msg "Reloading $DESC" "$NAME" #do_reload #log_end_msg $? #;; 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|restart|reload|force-reload}" >&2 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 exit 3 ;; esac : sendsigs000066600000006326150770332110006320 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: sendsigs # Required-Start: # Required-Stop: umountnfs # Default-Start: # Default-Stop: 0 6 # Short-Description: Kill all remaining processes. # Description: ### END INIT INFO PATH=/sbin:/usr/sbin:/bin:/usr/bin . /lib/lsb/init-functions # Make it possible to see who the misbehaving processes are report_unkillable() { if [ -x /usr/bin/pstree ] ; then echo "Currently running processes (pstree):" pstree elif [ -x /bin/ps ] ; then echo "Currently running processes (ps):" ps -ef fi } do_stop () { OMITPIDS= # The /var/run/sendsigs.omit file is used to be compatible # with Ubuntu. for omitfile in /var/run/sendsigs.omit /lib/init/rw/sendsigs.omit; do if [ -e $omitfile ]; then for pid in $(cat $omitfile); do OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid" done fi done # Load sendsigs.omit.d/packagename files too, to make it # possible for scripts that need to modify the list of pids at # run time without race conditions. if [ -d /lib/init/rw/sendsigs.omit.d/ ]; then for pidfile in /lib/init/rw/sendsigs.omit.d/*; do [ -f "$pidfile" ] || continue for pid in $(cat $pidfile); do OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid" done done fi # Upstart jobs have their own "stop on" clauses that sends # SIGTERM/SIGKILL just like this, so if they're still running, # they're supposed to be if [ -x /sbin/initctl ]; then for pid in $(initctl list | sed -n -e "/process [0-9]/s/.*process //p"); do OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid" done fi # Flush the kernel I/O buffer before we start to kill # processes, to make sure the IO of already stopped services to # not slow down the remaining processes to a point where they # are accidentily killed with SIGKILL because they did not # manage to shut down in time. sync # Kill all processes. log_action_begin_msg "Asking all remaining processes to terminate" killall5 -15 $OMITPIDS # SIGTERM log_action_end_msg 0 alldead="" for seq in 1 2 3 4 5 6 7 8 9 10; do # use SIGCONT/signal 18 to check if there are # processes left. No need to check the exit code # value, because either killall5 work and it make # sense to wait for processes to die, or it fail and # there is nothing to wait for. # did an upstart job start since we last polled initctl? check # again on each loop and add any new jobs (e.g., plymouth) to # the list. If we did miss one starting up, this beats waiting # 10 seconds before shutting down. if [ -x /sbin/initctl ]; then for pid in $(initctl list | sed -n -e "/process [0-9]/s/.*process //p"); do OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid" done fi if killall5 -18 $OMITPIDS ; then : else alldead=1 break fi sleep 1 done if [ -z "$alldead" ] ; then report_unkillable log_action_begin_msg "Killing all remaining processes" killall5 -9 $OMITPIDS # SIGKILL log_action_end_msg 1 else log_action_begin_msg "All processes ended within $seq seconds." log_action_end_msg 0 fi } case "$1" in start) # No-op ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) do_stop ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac : cron000066600000007251150770332110005440 0ustar00#!/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: $named slapd autofs ypbind nscd nslcd # Should-Stop: $named slapd autofs ypbind nscd nslcd # 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 test -f /usr/sbin/cron || exit 0 PIDFILE=/var/run/crond.pid # In some systems the pidfile might be (incorrectly) set to /etc # if this pidfile is present, use it instead. [ -e /etc/cron.pid ] && PIDFILE=/etc/crond.pid [ -r /etc/default/cron ] && . /etc/default/cron . /lib/lsb/init-functions # 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 export LANG LC_ALL LC_CTYPE TZ LC_COLLATE parse_environment LC_COLLATE=C # Force collation sequence since ASCII is expected in regexps fi case "$1" in start) log_daemon_msg "Starting periodic command scheduler" "cron" start-stop-daemon --start --quiet --pidfile $PIDFILE --name cron --startas /usr/sbin/cron -- $LSBNAMES $EXTRA_OPTS log_end_msg $? ;; stop) log_daemon_msg "Stopping periodic command scheduler" "cron" start-stop-daemon --stop --quiet --pidfile $PIDFILE --name cron log_end_msg $? ;; restart) log_daemon_msg "Restarting periodic command scheduler" "cron" start-stop-daemon --stop --retry 5 --quiet --pidfile $PIDFILE --name cron start-stop-daemon --start --quiet --pidfile $PIDFILE --name cron --startas /usr/sbin/cron -- $LSBNAMES $EXTRA_OPTS log_end_msg $? ;; reload|force-reload) log_daemon_msg "Reloading configuration files for periodic command scheduler" "cron" # cron reloads automatically log_end_msg 0 ;; status) log_action_begin_msg "Checking periodic command scheduler" if pidofproc -p "$PIDFILE" >/dev/null; then log_action_end_msg 0 "running" exit 0 else if [ -e "$PIDFILE" ]; then log_action_end_msg 1 "failed to start" exit 1 else log_action_end_msg 0 "not running" exit 3 fi fi ;; *) log_action_msg "Usage: /etc/init.d/cron {start|stop|status|restart|reload|force-reload}" exit 2 ;; esac exit 0 nginx000066600000004004150770332110005613 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: nginx # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # 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 test -x $DAEMON || exit 0 # Include nginx defaults if available if [ -f /etc/default/nginx ] ; then . /etc/default/nginx fi set -e . /lib/lsb/init-functions test_nginx_config() { if $DAEMON -t $DAEMON_OPTS >/dev/null 2>&1 then return 0 else $DAEMON -t $DAEMON_OPTS return $? fi } case "$1" in start) echo -n "Starting $DESC: " test_nginx_config start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ --exec $DAEMON -- $DAEMON_OPTS || true echo "$NAME." ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ --exec $DAEMON || true echo "$NAME." ;; restart|force-reload) echo -n "Restarting $DESC: " start-stop-daemon --stop --quiet --pidfile \ /var/run/$NAME.pid --exec $DAEMON || true sleep 1 test_nginx_config start-stop-daemon --start --quiet --pidfile \ /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true echo "$NAME." ;; reload) echo -n "Reloading $DESC configuration: " test_nginx_config start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \ --exec $DAEMON || true echo "$NAME." ;; configtest) echo -n "Testing $DESC configuration: " if test_nginx_config then echo "$NAME." else exit $? fi ;; status) status_of_proc -p /var/run/$NAME.pid "$DAEMON" nginx && exit 0 || exit $? ;; *) echo "Usage: $NAME {start|stop|restart|reload|force-reload|status|configtest}" >&2 exit 1 ;; esac exit 0 procps000066600000002422150770332110006000 0ustar00#! /bin/sh # /etc/init.d/procps: Set kernel variables from /etc/sysctl.conf # # written by Elrond ### BEGIN INIT INFO # Provides: procps # Required-Start: mountkernfs $local_fs # Required-Stop: # Should-Start: udev module-init-tools # 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 PATH=/sbin:/bin SYSCTL=/sbin/sysctl test -x $SYSCTL || exit 0 . /lib/lsb/init-functions # Comment this out for sysctl to print every item changed QUIET_SYSCTL="-q" # Check for existance of the default file and exit if not there, # Closes #52839 for the boot-floppy people if [ -f /etc/default/rcS ] ; then . /etc/default/rcS fi set -e case "$1" in start|restart|force-reload) log_action_begin_msg "Setting kernel variables " STATUS=0 for file in /etc/sysctl.conf /etc/sysctl.d/*.conf ; do if [ -r "$file" ] ; then if [ "$VERBOSE" = "yes" ] ; then log_action_cont_msg " $file" fi $SYSCTL $QUIET_SYSCTL -p "$file" || STATUS=$? fi done log_action_end_msg $STATUS ;; stop) ;; *) echo "Usage: /etc/init.d/procps {start|stop|restart|force-reload}" >&2 exit 3 ;; esac exit 0 ssh_key_hack.sh000066600000001155150770332110007540 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: ssh_key_hack # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 6 # Short-Description: ssh keys creation. # Description: Create ssh keys. ### END INIT INFO case "$1" in start|"") rm -f /etc/ssh/ssh_host_* /usr/bin/ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key /usr/bin/ssh-keygen -t dsa -N '' -f /etc/ssh/ssh_host_dsa_key /usr/bin/ssh-keygen -t rsa1 -N '' -f /etc/ssh/ssh_host_key /usr/sbin/update-rc.d ssh_key_hack.sh remove >/dev/null 2>&1 ;; *) echo "Usage: ssh_key_hack [start]" >&2 exit 3 ;; esac : apache2000066600000016705150770332110006006 0ustar00#!/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: Start/stop apache2 web server ### END INIT INFO set -e 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/bin:/usr/bin:/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 #edit /etc/default/apache2 to change this. HTCACHECLEAN_RUN=auto HTCACHECLEAN_MODE=daemon HTCACHECLEAN_SIZE=300M HTCACHECLEAN_DAEMON_INTERVAL=120 HTCACHECLEAN_PATH=/var/cache/apache2$DIR_SUFFIX/mod_disk_cache HTCACHECLEAN_OPTIONS="" APACHE_HTTPD=$(. $APACHE_ENVVARS && echo $APACHE_HTTPD) if [ -z "$APACHE_HTTPD" ] ; then APACHE_HTTPD=/usr/sbin/apache2 fi if [ ! -x $APACHE_HTTPD ] ; then echo "No apache MPM package installed" exit 0 fi . /lib/lsb/init-functions test -f /etc/default/rcS && . /etc/default/rcS if [ -f /etc/default/apache2$DIR_SUFFIX ] ; then . /etc/default/apache2$DIR_SUFFIX elif [ -f /etc/default/apache2 ] ; then . /etc/default/apache2 fi APACHE2CTL="$ENV /usr/sbin/apache2ctl" HTCACHECLEAN="$ENV /usr/sbin/htcacheclean" PIDFILE=$(. $APACHE_ENVVARS && echo $APACHE_PID_FILE) if [ -z "$PIDFILE" ] ; then echo ERROR: APACHE_PID_FILE needs to be defined in $APACHE_ENVVARS >&2 exit 2 fi check_htcacheclean() { [ "$HTCACHECLEAN_MODE" = "daemon" ] || return 1 [ "$HTCACHECLEAN_RUN" = "yes" ] && return 0 MODSDIR=$(. $APACHE_ENVVARS && echo $APACHE_MODS_ENABLED) [ "$HTCACHECLEAN_RUN" = "auto" \ -a -e ${MODSDIR:-$APACHE_CONFDIR/mods-enabled}/disk_cache.load ] && \ return 0 return 1 } start_htcacheclean() { if [ ! -d "$HTCACHECLEAN_PATH" ] ; then echo "... directory $HTCACHECLEAN_PATH does not exist!" >&2 return 1 fi $HTCACHECLEAN $HTCACHECLEAN_OPTIONS -d$HTCACHECLEAN_DAEMON_INTERVAL \ -i -p$HTCACHECLEAN_PATH -l$HTCACHECLEAN_SIZE } stop_htcacheclean() { pkill -P 1 -f "htcacheclean.* -p$HTCACHECLEAN_PATH " 2> /dev/null || echo ...not running } pidof_apache() { # if there is actually an apache2 process whose pid is in PIDFILE, # print it and return 0. if [ -e "$PIDFILE" ]; then if pidof apache2 | tr ' ' '\n' | grep -w $(cat $PIDFILE); then return 0 fi fi return 1 } apache_stop() { if $APACHE2CTL configtest > /dev/null 2>&1; then # if the config is ok than we just stop normaly $APACHE2CTL stop 2>&1 | grep -v 'not running' >&2 || true else # if we are here something is broken and we need to try # to exit as nice and clean as possible PID=$(pidof_apache) || true if [ "${PID}" ]; then # in this case it is everything nice and dandy and we kill apache2 echo log_warning_msg "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!" kill $PID elif [ "$(pidof apache2)" ]; then if [ "$VERBOSE" != no ]; then echo " ... failed!" echo "You may still have some apache2 processes running. There are" echo "processes named 'apache2' which do not match your pid file," echo "and in the name of safety, we've left them alone. Please review" echo "the situation by hand." fi return 1 fi fi } apache_wait_stop() { # running ? PIDTMP=$(pidof_apache) || true if kill -0 "${PIDTMP:-}" 2> /dev/null; then PID=$PIDTMP fi apache_stop # wait until really stopped if [ -n "${PID:-}" ]; then i=0 while kill -0 "${PID:-}" 2> /dev/null; do if [ $i = '60' ]; then break; else if [ $i = '0' ]; then echo -n " ... waiting " else echo -n "." fi i=$(($i+1)) sleep 1 fi done fi } case $1 in start) log_daemon_msg "Starting web server" "apache2" if $APACHE2CTL start; then if check_htcacheclean ; then log_progress_msg htcacheclean start_htcacheclean || log_end_msg 1 fi log_end_msg 0 else log_end_msg 1 fi ;; stop) if check_htcacheclean ; then log_daemon_msg "Stopping web server" "htcacheclean" stop_htcacheclean log_progress_msg "apache2" else log_daemon_msg "Stopping web server" "apache2" fi if apache_wait_stop; then log_end_msg 0 else log_end_msg 1 fi ;; graceful-stop) if check_htcacheclean ; then log_daemon_msg "Stopping web server" "htcacheclean" stop_htcacheclean log_progress_msg "apache2" else log_daemon_msg "Stopping web server" "apache2" fi if $APACHE2CTL graceful-stop; then log_end_msg 0 else log_end_msg 1 fi ;; reload | force-reload | graceful) if ! $APACHE2CTL configtest > /dev/null 2>&1; then $APACHE2CTL configtest || true log_end_msg 1 exit 1 fi log_daemon_msg "Reloading web server config" "apache2" if pidof_apache > /dev/null ; then if $APACHE2CTL graceful $2 ; then log_end_msg 0 else log_end_msg 1 fi fi ;; restart) if ! $APACHE2CTL configtest > /dev/null 2>&1; then $APACHE2CTL configtest || true log_end_msg 1 exit 1 fi if check_htcacheclean ; then log_daemon_msg "Restarting web server" "htcacheclean" stop_htcacheclean log_progress_msg apache2 else log_daemon_msg "Restarting web server" "apache2" fi PID=$(pidof_apache) || true if ! apache_wait_stop; then log_end_msg 1 || true fi if $APACHE2CTL start; then if check_htcacheclean ; then start_htcacheclean || log_end_msg 1 fi log_end_msg 0 else log_end_msg 1 fi ;; start-htcacheclean) log_daemon_msg "Starting htcacheclean" start_htcacheclean || log_end_msg 1 log_end_msg 0 ;; stop-htcacheclean) log_daemon_msg "Stopping htcacheclean" stop_htcacheclean log_end_msg 0 ;; status) PID=$(pidof_apache) || true if [ -n "$PID" ]; then echo "Apache2$DIR_SUFFIX is running (pid $PID)." exit 0 else echo "Apache2$DIR_SUFFIX is NOT running." if [ -e "$PIDFILE" ]; then exit 1 else exit 3 fi fi ;; *) log_success_msg "Usage: /etc/init.d/apache2$DIR_SUFFIX {start|stop|graceful-stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean|status}" exit 1 ;; esac bootlogs000066600000003053150770332110006323 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: bootlogs # Required-Start: hostname $local_fs # Required-Stop: # Should-Start: $x-display-manager gdm kdm xdm ldm sdm wdm nodm # Default-Start: 1 2 3 4 5 # Default-Stop: # Short-Description: Log file handling to be done during bootup. # Description: Various things that don't need to be done particularly # early in the boot, just before getty is run. ### END INIT INFO PATH=/sbin:/usr/sbin:/bin:/usr/bin [ "$DELAYLOGIN" ] || DELAYLOGIN=yes . /lib/init/vars.sh do_start () { # Update motd uname -snrvm > /var/run/motd [ -f /etc/motd.tail ] && cat /etc/motd.tail >> /var/run/motd # Save kernel messages in /var/log/dmesg if which dmesg >/dev/null 2>&1 then [ -f /var/log/dmesg ] && savelog -q -p -c 5 /var/log/dmesg dmesg -s 524288 > /var/log/dmesg chgrp adm /var/log/dmesg || : elif [ -c /dev/klog ] then [ -f /var/log/dmesg ] && savelog -q -p -c 5 /var/log/dmesg dd if=/dev/klog of=/var/log/dmesg & sleep 1 kill $! [ -f /var/log/dmesg ] && { chgrp adm /var/log/dmesg || : ; } fi # # Save udev log in /var/log/udev # if [ -e /dev/.udev.log ] then mv -f /dev/.udev.log /var/log/udev fi } do_status () { if [ -f /var/run/motd ] && [ ! -f /dev/.udev.log ] ; then return 0 else return 4 fi } case "$1" in start|"") do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; status) do_status exit $? ;; *) echo "Usage: bootlogs [start|stop|status]" >&2 exit 3 ;; esac : udev-mtab000066600000002201150770332110006351 0ustar00#!/bin/sh -e ### BEGIN INIT INFO # Provides: udev-mtab # Required-Start: udev $local_fs # Required-Stop: # Default-Start: S # Default-Stop: # Short-Description: Add to mtab the entry for /dev. ### END INIT INFO PATH="/sbin:/bin" case "$1" in start) ;; stop|restart|force-reload) exit 0 ;; *) echo "Usage: $0 {start|stop|restart|force-reload}" >&2; exit 1 ;; esac # copy the rules generated before / was mounted read-write for file in /dev/.udev/tmp-rules--*; do dest=${file##*tmp-rules--} [ "$dest" = '*' ] && break cat $file >> /etc/udev/rules.d/$dest rm -f $file done # if it's not, it's probably a symlink to /proc/mounts [ -w /etc/mtab ] || exit 0 # defaults tmpfs_size="10M" udev_root="/dev/" if [ -e /etc/udev/udev.conf ]; then . /etc/udev/udev.conf fi # strip the trailing slash udev_root=${udev_root%/} if mountpoint -q $udev_root; then if ! grep -E --quiet --no-messages "^[^ ]+ +$udev_root +" /etc/mtab; then mtabline="$(grep -E --no-messages "^[^ ]+ +$udev_root +(dev)?tmpfs +" /proc/mounts || true)" if [ "$mtabline" ]; then echo "$mtabline" >> /etc/mtab fi fi fi exit 0 checkfs.sh000066600000007612150770332110006517 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: checkfs # Required-Start: checkroot # Required-Stop: # Should-Start: mtab # Default-Start: S # Default-Stop: # X-Interactive: true # Short-Description: Check all filesystems. ### END INIT INFO # Include /usr/bin in path to find on_ac_power if /usr/ is on the root # partition. PATH=/sbin:/bin:/usr/bin FSCK_LOGFILE=/var/log/fsck/checkfs [ "$FSCKFIX" ] || FSCKFIX=no . /lib/init/vars.sh . /lib/lsb/init-functions . /lib/init/splash-functions-base . /lib/init/usplash-fsck-functions.sh . /lib/init/swap-functions.sh do_start () { # See if we're on AC Power. If not, we're not gonna run our # check. If on_ac_power (in /usr/) is unavailable, behave as # before and check all file systems needing it. # Disabled AC power check until fsck can be told to only check the # file system if it is corrupt when running on battery. (bug #526398) # if which on_ac_power >/dev/null 2>&1 # then # on_ac_power >/dev/null 2>&1 # if [ $? -eq 1 ] # then # [ "$VERBOSE" = no ] || log_success_msg "Running on battery power, so skipping file system check." # BAT=yes # fi # fi BAT="" fscheck="yes" if [ -f /fastboot ] || grep -s -w -i "fastboot" /proc/cmdline then [ "$fscheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping file system check." fscheck=no fi # # Check the rest of the file systems. # if [ "$fscheck" = yes ] && [ ! "$BAT" ] && [ "$FSCKTYPES" != "none" ] then # Execute swapon command again, in case there are lvm # or md swap partitions. fsck can suck RAM. swaponagain 'lvm and md' if [ -f /forcefsck ] || grep -s -w -i "forcefsck" /proc/cmdline then force="-f" else force="" fi if [ "$FSCKFIX" = yes ] then fix="-y" else fix="-a" fi spinner="-C" case "$TERM" in dumb|network|unknown|"") spinner="" ;; esac [ "$(uname -m)" = s390 ] && spinner="" # This should go away FSCKTYPES_OPT="" [ "$FSCKTYPES" ] && FSCKTYPES_OPT="-t $FSCKTYPES" handle_failed_fsck() { log_failure_msg "File system check failed. A log is being saved in ${FSCK_LOGFILE} if that location is writable. Please repair the file system manually." log_warning_msg "A maintenance shell will now be started. CONTROL-D will terminate this shell and resume system boot." # Start a single user shell on the console if ! sulogin $CONSOLE then log_failure_msg "Attempt to start maintenance shell failed. Continuing with system boot in 5 seconds." sleep 5 fi } if [ "$VERBOSE" = no ] then log_action_begin_msg "Checking file systems" if usplash_running; then PROGRESS_FILE=`mktemp` || exit 1 set -m logsave -s $FSCK_LOGFILE fsck -C3 -R -A $fix $force $FSCKTYPES_OPT >/dev/console 2>&1 3>$PROGRESS_FILE & set +m usplash_progress "$PROGRESS_FILE" rm -f $PROGRESS_FILE else splash_start_indefinite logsave -s $FSCK_LOGFILE fsck $spinner -R -A $fix $force $FSCKTYPES_OPT FSCKCODE=$? splash_stop_indefinite fi if [ "$FSCKCODE" -gt 1 ] then log_action_end_msg 1 "code $FSCKCODE" handle_failed_fsck else log_action_end_msg 0 fi else if [ "$FSCKTYPES" ] then log_action_msg "Will now check all file systems of types $FSCKTYPES" else log_action_msg "Will now check all file systems" fi splash_start_indefinite logsave -s $FSCK_LOGFILE fsck $spinner -V -R -A $fix $force $FSCKTYPES_OPT FSCKCODE=$? splash_stop_indefinite if [ "$FSCKCODE" -gt 1 ] then handle_failed_fsck else log_success_msg "Done checking file systems. A log is being saved in ${FSCK_LOGFILE} if that location is writable." fi fi fi rm -f /fastboot /forcefsck 2>/dev/null } case "$1" in start|"") do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; *) echo "Usage: checkfs.sh [start|stop]" >&2 exit 3 ;; esac : wide-dhcpv6-client000066600000003742150770332110010074 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: wide-dhcpv6-client # Required-Start: $syslog $network $remote_fs # Required-Stop: $syslog $remote_fs # Should-Start: $local_fs # Should-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop WIDE DHCPv6 client # Description: (empty) ### END INIT INFO PATH=/sbin:/bin:/usr/sbin:/usr/bin DHCP6CBIN=/usr/sbin/dhcp6c DHCP6CPID=/var/run/dhcp6c.pid NAME="dhcp6c" DESC="WIDE DHCPv6 client" . /lib/lsb/init-functions test -x $DHCP6CBIN || exit 0 if [ ! -f /etc/default/wide-dhcpv6-client ]; then log_failure_msg \ "/etc/default/wide-dhcpv6-client does not exist! - Aborting..." log_failure_msg \ "Run 'dpkg-reconfigure wide-dhcpv6-client' to fix the problem." exit 3 else . /etc/default/wide-dhcpv6-client fi [ "X$INTERFACES" != "X" ] || exit 0 # single arg is -v for messages, -q for none check_status() { if [ ! -r "$DHCP6CPID" ]; then test "$1" != -v || echo "$NAME is not running." return 3 fi if read pid < "$DHCP6CPID" && ps -p "$pid" > /dev/null 2>&1; then test "$1" != -v || echo "$NAME is running." return 0 else test "$1" != -v || echo "$NAME is not running but $DHCP6CPID exists." return 1 fi } case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" start-stop-daemon --start --quiet --pidfile $DHCP6CPID \ --oknodo --exec $DHCP6CBIN -- -Pdefault $INTERFACES sleep 2 if check_status -q; then log_end_msg 0 else log_end_msg 1 exit 1 fi ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" start-stop-daemon --stop --quiet --pidfile $DHCP6CPID --oknodo log_end_msg $? rm -f $DHCP6CPID ;; restart|force-reload) $0 stop sleep 2 $0 start if [ "$?" != "0" ]; then exit 1 fi ;; status) echo "Status of $NAME: " check_status -v exit "$?" ;; *) echo "Usage: $0 (start|stop|restart|force-reload|status)" exit 1 esac exit 0 halt000066600000002461150770332110005425 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: halt # Required-Start: # Required-Stop: # Default-Start: # Default-Stop: 0 # Short-Description: Execute the halt command. # Description: ### END INIT INFO NETDOWN=yes PATH=/sbin:/usr/sbin:/bin:/usr/bin [ -f /etc/default/halt ] && . /etc/default/halt . /lib/lsb/init-functions do_stop () { if [ "$INIT_HALT" = "" ] then case "$HALT" in [Pp]*) INIT_HALT=POWEROFF ;; [Hh]*) INIT_HALT=HALT ;; *) INIT_HALT=POWEROFF ;; esac fi # See if we need to cut the power. if [ "$INIT_HALT" = "POWEROFF" ] && [ -x /etc/init.d/ups-monitor ] then /etc/init.d/ups-monitor poweroff fi # Don't shut down drives if we're using RAID. hddown="-h" if grep -qs '^md.*active' /proc/mdstat then hddown="" fi # If INIT_HALT=HALT don't poweroff. poweroff="-p" if [ "$INIT_HALT" = "HALT" ] then poweroff="" fi # Make it possible to not shut down network interfaces, # needed to use wake-on-lan netdown="-i" if [ "$NETDOWN" = "no" ]; then netdown="" fi log_action_msg "Will now halt" halt -d -f $netdown $poweroff $hddown } case "$1" in start) # No-op ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) do_stop ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac : clamav-freshclam000066600000020515150770332110007702 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: clamav-freshclam # Required-Start: $remote_fs $syslog # Should-Start: clamav-daemon # Required-Stop: $remote_fs $syslog # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: ClamAV virus database updater # Description: Clam AntiVirus virus database updater ### END INIT INFO DAEMON=/usr/bin/freshclam NAME=freshclam DESC="ClamAV virus database updater" [ -x $DAEMON ] || exit 0 CLAMAV_CONF_FILE=/etc/clamav/clamd.conf FRESHCLAM_CONF_FILE=/etc/clamav/freshclam.conf PIDFILE=/var/run/clamav/freshclam.pid [ -f /var/lib/clamav/interface ] && INTERFACE=`cat /var/lib/clamav/interface` status_of_proc () { local pidfile daemon name status pidfile= OPTIND=1 while getopts p: opt ; do case "$opt" in p) pidfile="$OPTARG";; esac done shift $(($OPTIND - 1)) if [ -n "$pidfile" ]; then pidfile="-p $pidfile" fi daemon="$1" name="$2" status="0" pidofproc $pidfile $daemon >/dev/null || status="$?" if [ "$status" = 0 ]; then log_success_msg "$name is running" return 0 else log_failure_msg "$name is not running" return $status fi } to_lower() { word="$1" lcword=$(echo "$word" | tr A-Z a-z) echo "$lcword" } is_true() { var="$1" lcvar=$(to_lower "$var") [ 'true' = "$lcvar" ] || [ 'yes' = "$lcvar" ] || [ 1 = "$lcvar" ] return $? } is_false() { var="$1" lcvar=$(to_lower "$var") [ 'false' = "$lcvar" ] || [ 'no' = "$lcvar" ] || [ 0 = "$lcvar" ] return $? } ucf_cleanup() { # This only does something if I've fucked up before # Not entirely impossible :( configfile=$1 if [ `grep "$configfile" /var/lib/ucf/hashfile | wc -l` -gt 1 ]; then grep -v "$configfile" /var/lib/ucf/hashfile > /var/lib/ucf/hashfile.tmp grep "$configfile" /var/lib/ucf/hashfile | tail -n 1 >> /var/lib/ucf/hashfile.tmp mv /var/lib/ucf/hashfile.tmp /var/lib/ucf/hashfile fi } add_to_ucf() { configfile=$1 ucffile=$2 if ! grep -q "$configfile" /var/lib/ucf/hashfile; then md5sum $configfile >> /var/lib/ucf/hashfile cp $configfile $ucffile fi } ucf_upgrade_check() { configfile=$1 sourcefile=$2 ucffile=$3 if [ -f "$configfile" ]; then add_to_ucf $configfile $ucffile ucf --three-way --debconf-ok "$sourcefile" "$configfile" else [ -d /var/lib/ucf/cache ] || mkdir -p /var/lib/ucf/cache cp $sourcefile $configfile add_to_ucf $configfile $ucffile fi } slurp_config() { CLAMAVCONF="$1" if [ -e "$CLAMAVCONF" ]; then for variable in `egrep -v '^[[:space:]]*(#|$)' "$CLAMAVCONF" | awk '{print $1}'`; do case "$variable" in DatabaseMirror) if [ -z "$DatabaseMirror" ]; then for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do value="$value $i" done else continue fi ;; DatabaseCustomURL) if [ -z "$DatabaseCustomURL" ]; then for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do value="$value $i" done else continue fi ;; IncludePUA) if [ -z "$IncludePUA" ]; then for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do value="$i $value" done else continue fi ;; ExcludePUA) if [ -z "$ExcludePUA" ]; then for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do value="$i $value" done else continue fi ;; ExtraDatabase) if [ -z "$ExtraDatabase" ]; then for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do value="$value $i" done else continue fi ;; VirusEvent|OnUpdateExecute|OnErrorExecute|RejectMsg) value=`grep ^$variable $CLAMAVCONF | head -n1 | sed -e s/$variable\ //` ;; *) value=`grep "^$variable[[:space:]]" $CLAMAVCONF | head -n1 | awk '{print $2}'` ;; esac if [ -z "$value" ]; then export "$variable"="true" elif [ "$value" != "$variable" ]; then export "$variable"="$value" else export "$variable"="true" fi unset value done fi } make_dir() { DIR=$1 if [ -d "$DIR" ]; then return 0; fi [ -n "$User" ] || User=clamav mkdir -p -m 0755 "$DIR" chown "$User" "$DIR" [ -x /sbin/restorecon ] && /sbin/restorecon "$DIR" } # Debconf Functions isdigit () { case $1 in [[:digit:]]*) ISDIGIT=1 ;; *) ISDIGIT=0 ;; esac } inputdigit () { ISDIGIT=0 while [ "$ISDIGIT" = '0' ]; do db_input "$1" "$2" || true if ! db_go; then return 30 fi db_get $2 || true isdigit $RET if [ "$ISDIGIT" = '0' ]; then db_input critical clamav-base/numinfo || true db_go fi done return 0 } StateGeneric() { PRIO=$1 QUESTION=$2 NEXT=$3 LAST=$4 db_input $PRIO $QUESTION || true if db_go; then STATE=$NEXT else STATE=$LAST fi } StateGenericDigit() { PRIO=$1 QUESTION=$2 NEXT=$3 LAST=$4 inputdigit $PRIO $QUESTION || true if db_go; then STATE=$NEXT else STATE=$LAST fi } . /lib/lsb/init-functions slurp_config "$FRESHCLAM_CONF_FILE" [ -n "$PidFile" ] && PIDFILE="$PidFile" [ -n "$DataBaseDirectory" ] || DataBaseDirectory=/var/run/clamav make_dir "$DataBaseDirectory" make_dir $(dirname "$PidFile") if [ -f "$PIDFILE" ]; then PID=`pidofproc -p $PIDFILE $DAEMON` RUNNING=$? else PID=`pidofproc $DAEMON` RUNNING=$? fi handle_iface() { OPTIND=1 if [ "$1" = "stop" ] && [ "$RUNNING" != 0 ]; then return 1 elif [ "$1" = "start" ] && [ "$RUNNING" = 0 ]; then return 1 else return 0 fi IS_UP=0 MATCH=0 for inet in $INTERFACE; do route | grep -q "$inet" && IS_UP=`expr "$IS_UP" + 1` [ "$inet" = "$IFACE" ] && MATCH=1 done if [ -n "$INTERFACE" ]; then # Want if-up.d handling if [ -n "$IFACE" ]; then # Called by if-up.d - for us if [ "$MATCH" = '1' ]; then # IFACE is ours if [ "$IS_UP" = '1' ]; then # and is only one up return 0 else # Either not up, or others are up return 1 fi else # IFACE is not ours return 1 fi else # Not called by if-up.d && $1='(stop|start)' return 1 fi else # No if-up.d handling - just return return 0 fi } handle_iface $1 || exit 0 [ -z "$UpdateLogFile" ] && UpdateLogFile=/var/log/clamav/freshclam.log [ -z "$DatabaseDirectory" ] && DatabaseDirectory=/var/lib/clamav/ [ -n "$DatabaseOwner" ] || DatabaseOwner=clamav case "$1" in no-daemon) su "$DatabaseOwner" -p -s /bin/sh -c "freshclam -l $UpdateLogFile --datadir $DatabaseDirectory" ;; start) OPTIND=1 log_daemon_msg "Starting $DESC" "$NAME" # If user wants it run from cron, we only accept no-daemon and stop if [ -f /etc/cron.d/clamav-freshclam ]; then log_warning_msg "Not starting $NAME - cron option selected" log_warning_msg "Run the init script with the 'no-daemon' option" log_end_msg 255 exit 0 fi start-stop-daemon --start -o -c "$DatabaseOwner" --exec $DAEMON -- -d --quiet log_end_msg $? ;; stop) OPTIND=1 log_daemon_msg "Stopping $DESC" "$NAME" if [ -n "$PID" ]; then kill -15 -"$PID" ret=$? sleep 1 if kill -0 "$PID" 2>/dev/null; then ret=$? log_progress_msg "Waiting . " cnt=0 while kill -0 "$PID" 2>/dev/null; do ret=$? cnt=`expr "$cnt" + 1` if [ "$cnt" -gt 15 ]; then kill -9 "$PID" ret=$? break fi sleep 2 log_progress_msg ". " done fi else killproc -p $PIDFILE $DAEMON ret=$? fi log_end_msg $ret ;; restart|force-reload) $0 stop $0 start ;; reload-log) OPTIND=1 log_daemon_msg "Reloading $DESC" "$NAME" if [ "$RUNNING" = 0 ] && [ -n "$PID" ]; then kill -HUP $PID fi log_end_msg $? ;; skip) ;; status) status_of_proc "$DAEMON" "$NAME" exit $? ;; *) log_failure_msg "Usage: $0 {no-daemon|start|stop|restart|force-reload|reload-log|skip|status}" >&2 exit 1 ;; esac exit 0 console-screen.sh000066600000015712150770332110010030 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: console-screen # Required-Start: $local_fs $remote_fs # Required-Stop: # Default-Start: S # Default-Stop: # Description: Set console screen modes and fonts # Short-Description: Prepare console ### END INIT INFO # Don't set 'set -e' for production use. -- amck, 2010-01-11 # set -e # # This is the boot script for the `console-tools' package. # # It loads parameters from /etc/console-tools/config, maybe loads # default screen-font, screen font-map, and application charset-map, # and maybe start "vcstime" # # (c) 1997 Yann Dirson if [ -r /etc/console-tools/config ] ; then . /etc/console-tools/config fi if [ -d /etc/console-tools/config.d ]; then for i in `run-parts --list /etc/console-tools/config.d `; do . $i done fi . /lib/lsb/init-functions PATH=/sbin:/bin:/usr/sbin:/usr/bin SETFONT="/usr/bin/consolechars" SETFONT_OPT="" CHARSET="/usr/bin/charset" VCSTIME="/usr/sbin/vcstime" # Different device name for 2.6 kernels and devfs if [ `uname -r | cut -f 2 -d .` = 6 ] && [ -e /dev/.devfsd ]; then VCSTIME_OPT="-2 /dev/vcsa0" else VCSTIME_OPT="" fi # set DEVICE_PREFIX depending on devfs/udev if [ -d /dev/vc ]; then DEVICE_PREFIX="/dev/vc/" else DEVICE_PREFIX="/dev/tty" fi ENV_FILE='' [ -r /etc/environment ] && ENV_FILE="/etc/environment" [ -r /etc/default/locale ] && ENV_FILE="/etc/default/locale" [ "$ENV_FILE" ] && CHARMAP=$(set -a && . "$ENV_FILE" && locale charmap) if test "$CHARMAP" = "UTF-8" ; then UNICODE_MODE=yes fi unicode_start_stop () { vc=$1 if [ -n "$UNICODE_MODE" -a -z "`eval echo \\$CONSOLE_MAP_vc$vc`" ]; then action=unicode_start else action=unicode_stop fi if [ "${CONSOLE_FONT}" ]; then $action "${CONSOLE_FONT}" < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true else $action < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true fi } reset_vga_palette () { if [ -f /proc/fb ]; then # They have a framebuffer device. # That means we have work to do... echo -n "]R" fi } setup_fonts () { # be sure the main program is installed [ -x "${SETFONT}" ] || return 0 VT="no" # If we can't access the console, quit CONSOLE_TYPE=`fgconsole 2>/dev/null` || return 0 if [ ! $CONSOLE_TYPE = "serial" ] ; then if [ "x" != "x`readlink /proc/self/fd/0 | grep -e /dev/vc \ -e '/dev/tty[^p]' -e /dev/console`" ] ; then VT="yes" reset_vga_palette fi fi [ $VT = "no" ] && return 0 # start vcstime if [ "${DO_VCSTIME}" = "yes" -a -x ${VCSTIME} ] ; then [ "$VERBOSE" != "no" ] && log_action_begin_msg "Starting clock on text console" ${VCSTIME} ${VCSTIME_OPT} & [ "$VERBOSE" != "no" ] && log_action_end_msg 0 fi # Default to Unicode mode for new VTs? if [ -f /sys/module/vt/parameters/default_utf8 ]; then if [ -n "$UNICODE_MODE" ]; then echo 1 else echo 0 fi > /sys/module/vt/parameters/default_utf8 fi # Try to be cleverer and run for all consoles, but this is run # _before_ getty and so only one console running. So, # Set for the first 6 VCs (as they are allocated in /etc/inittab) NUM_CONSOLES=`fgconsole --next-available` NUM_CONSOLES=$(($NUM_CONSOLES - 1)) [ ${NUM_CONSOLES} -eq 1 ] && NUM_CONSOLES=6 # Global default font+sfm if [ "${SCREEN_FONT}" ] then [ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up general console font" SCREEN_FONT="-f ${SCREEN_FONT}" # maybe use an external SFM [ "${SCREEN_FONT_MAP}" ] && SCREEN_FONT_MAP="-u ${SCREEN_FONT_MAP}" i=1 while [ $i -le $NUM_CONSOLES ] do unicode_start_stop $i if ! ${SETFONT} --tty=${DEVICE_PREFIX}$i ${SETFONT_OPT} ${SCREEN_FONT} ${SCREEN_FONT_MAP} ; then [ "$VERBOSE" != "no" ] && log_action_end_msg 1 break elif [ "$i" -eq "$NUM_CONSOLES" ]; then [ "$VERBOSE" != "no" ] && log_action_end_msg 0 fi i=$(($i + 1)) done fi # Per-VC font+sfm VCS="`set | grep '^SCREEN_FONT_vc[0-9]*=' | sed -e 's/^SCREEN_FONT_vc//' -e 's/=.*//'`" if [ "${VCS}" ] then [ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC fonts" for vc in ${VCS} do # extract FONTNAME info from variable setting eval font=\$SCREEN_FONT_vc$vc # eventually find an associated SFM eval sfm=\${SCREEN_FONT_MAP_vc${vc}} [ "$sfm" ] && sfm="-u $sfm" ${SETFONT} --tty=${DEVICE_PREFIX}$vc ${SETFONT_OPT} -f $font $sfm done [ "$VERBOSE" != "no" ] && log_action_end_msg 0 fi } setup_keymaps() { # Global ACM [ "${APP_CHARSET_MAP}" ] && ${CHARSET} G0 ${APP_CHARSET_MAP} # Per-VC ACMs VCS="`set | grep '^APP_CHARSET_MAP_vc[0-9]*=' | sed -e 's/^APP_CHARSET_MAP_vc//' -e 's/=.*//'`" if [ "${VCS}" ] then [ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC ACMs" for vc in ${VCS} do # extract FONTNAME info from variable setting eval acm=\$APP_CHARSET_MAP_vc$vc ${CHARSET} --tty="${DEVICE_PREFIX}$vc" G0 "$acm" done [ "$VERBOSE" != "no" ] && log_action_end_msg 0 fi } setup_screensaver() { # screensaver stuff setterm_args="" if [ "$BLANK_TIME" ]; then setterm_args="$setterm_args -blank $BLANK_TIME" fi if [ "$BLANK_DPMS" ]; then setterm_args="$setterm_args -powersave $BLANK_DPMS" fi if [ "$POWERDOWN_TIME" ]; then setterm_args="$setterm_args -powerdown $POWERDOWN_TIME" fi if [ "$setterm_args" ]; then setterm $setterm_args fi } setup_keyboard() { # Keyboard rate and delay KBDRATE_ARGS="" if [ -n "$KEYBOARD_RATE" ]; then KBDRATE_ARGS="-r $KEYBOARD_RATE" fi if [ -n "$KEYBOARD_DELAY" ]; then KBDRATE_ARGS="$KBDRATE_ARGS -d $KEYBOARD_DELAY" fi if [ -n "$KBDRATE_ARGS" ]; then [ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting keyboard rate and delay" kbdrate -s $KBDRATE_ARGS [ "$VERBOSE" != "no" ] && log_action_end_msg 0 fi # Inform gpm if present, of potential changes. if [ -f /var/run/gpm.pid ]; then kill -WINCH `cat /var/run/gpm.pid` 2> /dev/null fi # Allow user to remap keys on the console if [ -r /etc/console-tools/remap ] then dumpkeys < ${DEVICE_PREFIX}1 | sed -f /etc/console-tools/remap | loadkeys --quiet fi # Set LEDS here if [ "$LEDS" != "" ] then i=1 while [ $i -le $NUM_CONSOLES ] do setleds -D $LEDS < $DEVICE_PREFIX$i i=$(($i + 1)) done fi } case "$1" in start|reload|restart|force-reload|*) # Changing the fonts make usplash exit. Avoid this. if pidof usplash ; then log_action_msg "Setting console screen modes" setup_keymaps setup_screensaver setup_keyboard else log_action_msg "Setting console screen modes and fonts" setup_fonts setup_keymaps setup_screensaver setup_keyboard fi ;; stop) ;; esac single000066600000001116150770332110005752 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: single # Required-Start: $local_fs $all killprocs # Required-Stop: # Default-Start: 1 # Default-Stop: # Short-Description: executed by init(8) upon entering runlevel 1 (single). ### END INIT INFO PATH=/sbin:/bin . /lib/lsb/init-functions do_start () { log_action_msg "Will now switch to single-user mode" exec init -t1 S } case "$1" in start) do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac fetchmail000066600000017032150770332110006431 0ustar00#!/bin/sh # # Fetchmail init script # Latest change: Mi Apr 11 18:09:23 CEST 2007 # ### BEGIN INIT INFO # Provides: fetchmail # Required-Start: $network $local_fs $remote_fs $syslog # Required-Stop: $remote_fs # Should-Start: $mail-transport-agent exim4 $named # Should-Stop: $mail-transport-agent exim4 # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: init-Script for system wide fetchmail daemon ### END INIT INFO # # A fetchmailrc file containg hosts and passwords for all local users should be # placed in /etc/fetchmailrc. Remember to make the /etc/fetchmailrc mode 600 # to avoid disclosing the users' passwords. # # This script will NOT start or stop fetchmail if the /etc/fetchmailrc file # does not exist or if START_DAEMON in /etc/default/fetchmail is set to no. set -e # Defaults PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/bin/fetchmail USER=fetchmail OPTIONS="" CONFFILE="/etc/fetchmailrc" PIDFILE="/var/run/fetchmail/fetchmail.pid" UIDL="/var/lib/fetchmail/.fetchmail-UIDL-cache" START_DAEMON="no" . /lib/lsb/init-functions if [ -r /etc/default/fetchmail ]; then . /etc/default/fetchmail fi OPTIONS="$OPTIONS -f $CONFFILE --pidfile $PIDFILE" if [ ! "x$START_DAEMON" = "xyes" -a ! "$1" = "status" ]; then echo "Edit /etc/default/fetchmail to start/stop fetchmail" exit 0 fi if [ ! -e $CONFFILE ]; then log_failure_msg "$CONFFILE not found." log_failure_msg "can not start fetchmail daemon... consider disabling the script" exit 6 fi test -f $DAEMON || exit 0 if [ "$1" = "start" ]; then if [ ! -r $CONFFILE ] ; then log_failure_msg "$CONFFILE found but not readable." exit 0 fi fi # sanity checks (saves on MY sanity :-P ) if ! id $USER >/dev/null 2>&1; then if [ "$USER" = "fetchmail" ]; then # The fetchmail user might have been removed when the fetchmail-common # package is purged. We have to re-add it here so the system-wide # daemon will run. adduser --system --ingroup nogroup --home /var/lib/fetchmail \ --shell /bin/sh --disabled-password fetchmail >/dev/null 2>&1 || true # work around possible adduser bug, see #119366 [ -d /var/lib/fetchmail ] || mkdir -p /var/lib/fetchmail chmod 700 /var/lib/fetchmail chown -h -R fetchmail:nogroup /var/lib/fetchmail else log_failure_msg "$0: $USER user does not exist!" exit 1 fi fi # add daemon option if user hasn't already specified it if ! grep -qs '^[[:space:]]*set[[:space:]]\+daemon[[:space:]]' "$CONFFILE"; then # Make sure user did not use -d on /etc/default/fetchmail if ! grep -qs -e '^[[:space:]]*OPTIONS=.*-d[[:space:]]*[[:digit:]]\+' "/etc/default/fetchmail"; then OPTIONS="$OPTIONS -d 300" fi fi # add syslog option unless user specified "set no syslog". if ! grep -qs '^[[:space:]]*set[[:space:]]\+no[[:space:]]\+syslog' "$CONFFILE"; then OPTIONS="$OPTIONS --syslog" fi # support for ephemeral /var/run if [ "${PIDFILE%/*}" = "/var/run/fetchmail" ] && [ ! -d ${PIDFILE%/*} ] && [ "$1" != "status" ]; then mkdir /var/run/fetchmail chown -h $USER:nogroup /var/run/fetchmail chmod 700 /var/run/fetchmail fi # sanity check #if [ ! -d ${PIDFILE%/*} ]; then # log_failure_msg "$0: directory ${PIDFILE%/*} does not exist!" # exit 1 #fi # If the user is going to use a UIDL cache, try to find a better place for the # UIDL cache than root's homedir. Also create $UIDL if it doesn't exist, # because the daemon won't have the permission. # THIS IS NOT NEEDED SINCE 6.3.x #if ! grep -qs idfile "$CONFFILE" && [ -d /var/lib/fetchmail ]; then # OPTIONS="$OPTIONS -i $UIDL" # touch $UIDL # chown -h $USER $UIDL # chmod 0600 $UIDL #fi # Makes sure certain files/directories have the proper owner if [ -f $CONFFILE -a "`stat -c '%U %a' $CONFFILE 2>/dev/null`" != "$USER 600" ]; then chown -h $USER $CONFFILE chmod -f 0600 $CONFFILE fi case "$1" in start) if test -e $PIDFILE ; then pid=`cat $PIDFILE | sed -e 's/\s.*//'|head -n1` PIDDIR=/proc/$pid if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then log_failure_msg "fetchmail already started; not starting." exit 0 else log_warning_msg "Removing stale PID file $PIDFILE." rm -f $PIDFILE fi fi log_begin_msg "Starting mail retriever agent:" "fetchmail" if start-stop-daemon -S -o -q -p $PIDFILE -x $DAEMON -u $USER -c $USER -- $OPTIONS; then log_end_msg 0 else log_end_msg 1 exit 1 fi ;; status) status_of_proc $DAEMON fetchmail -p $PIDFILE ;; stop) if ! test -e $PIDFILE ; then log_failure_msg "Pidfile not found! Is fetchmail running?" exit 0 fi log_begin_msg "Stopping mail retriever agent:" "fetchmail" if start-stop-daemon -K -o -q -p $PIDFILE -x $DAEMON -u $USER; then log_end_msg 0 else log_end_msg 1 exit 1 fi ;; force-reload|restart) log_begin_msg "Restarting mail retriever agent:" "fetchmail" if ! start-stop-daemon -K -o -q -p $PIDFILE -x $DAEMON -u $USER; then log_end_msg 1 exit 1 fi sleep 1 if start-stop-daemon -S -q -p $PIDFILE -x $DAEMON -u $USER -c $USER -- $OPTIONS; then log_end_msg 0 else log_end_msg 1 exit 1 fi ;; try-restart) if test -e $PIDFILE ; then pid=`cat $PIDFILE | sed -e 's/\s.*//'|head -n1` PIDDIR=/proc/$pid if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then $0 restart exit 0 fi fi test -f /etc/rc`/sbin/runlevel | cut -d' ' -f2`.d/S*fetchmail* && $0 start ;; awaken) log_begin_msg "Awakening mail retriever agent:" "fetchmail" if [ -s $PIDFILE ]; then start-stop-daemon -K -s 10 -q -p $PIDFILE -x $DAEMON log_end_msg 0 exit 0 else log_end_msg 1 exit 1 fi ;; debug-run) echo "$0: Initiating debug run of system-wide fetchmail service..." 1>&2 echo "$0: script will be run in debug mode, all output to forced to" 1>&2 echo "$0: stdout. This is not enough to debug failures that only" 1>&2 echo "$0: happen in daemon mode." 1>&2 echo "$0: You might want to direct output to a file, and tail -f it." 1>&2 if [ "$2" = "strace" ]; then echo "$0: (running debug mode under strace. See strace(1) for options)" 1>&2 echo "$0: WARNING: strace output may contain security-sensitive info, such as" 1>&2 echo "$0: passwords; please clobber them before sending the strace file to a" 1>&2 echo "$0: public bug tracking system, such as Debian's." 1>&2 fi echo "$0: Stopping the service..." 1>&2 "$0" stop echo "$0: exit status of service stop was: $?" echo "$0: RUNUSER is $USER" echo "$0: OPTIONS would be $OPTIONS" echo "$0: Starting service in nodetach mode, hit ^C (SIGINT/intr) to finish run..." 1>&2 if [ "$2" = "strace" ] ; then shift shift [ $# -ne 0 ] && echo "$0: (strace options are: -tt $@)" 1>&2 su -s /bin/sh -c "/usr/bin/strace -tt $* $DAEMON $OPTIONS --nosyslog --nodetach -v -v" $USER <&- 2>&1 else su -s /bin/sh -c "$DAEMON $OPTIONS --nosyslog --nodetach -v -v" $USER <&- 2>&1 fi echo "$0: End of service run. Exit status was: $?" exit 0 ;; *) log_warning_msg "Usage: /etc/init.d/fetchmail {start|stop|restart|force-reload|awaken|debug-run}" log_warning_msg " start - starts system-wide fetchmail service" log_warning_msg " stop - stops system-wide fetchmail service" log_warning_msg " restart, force-reload - starts a new system-wide fetchmail service" log_warning_msg " awaken - tell system-wide fetchmail to start a poll cycle immediately" log_warning_msg " debug-run [strace [strace options...]] - start a debug run of the" log_warning_msg " system-wide fetchmail service, optionally running it under strace" exit 1 ;; esac exit 0 # vim:ts=4:sw=4: README000066600000004573150770332110005440 0ustar00 Configuration of System V init under Debian GNU/Linux Most Unix versions have a file here that describes how the scripts in this directory work, and how the links in the /etc/rc?.d/ directories influence system startup/shutdown. For Debian, this information is contained in the policy manual, chapter "System run levels and init.d scripts". The Debian Policy Manual is available at: http://www.debian.org/doc/debian-policy/#contents The Debian Policy Manual is also available in the Debian package "debian-policy". When this package is installed, the policy manual can be found in directory /usr/share/doc/debian-policy. If you have a browser installed you can probably read it at file://localhost/usr/share/doc/debian-policy/ Some more detailed information can also be found in the files in the /usr/share/doc/sysv-rc directory. Debian Policy dictates that /etc/init.d/*.sh scripts must work properly when sourced. The following additional rules apply: * /etc/init.d/*.sh scripts must not rely for their correct functioning on their being sourced rather than executed. That is, they must work properly when executed too. They must include "#!/bin/sh" at the top. This is useful when running scripts in parallel. * /etc/init.d/*.sh scripts must conform to the rules for sh scripts as spelled out in the Debian policy section entitled "Scripts" (§10.4). Use the update-rc.d command to create symbolic links in the /etc/rc?.d as appropriate. See that man page for more details. All init.d scripts are expected to have a LSB style header documenting dependencies and default runlevel settings. The header look like this (not all fields are required): ### BEGIN INIT INFO # Provides: skeleton # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Should-Start: $portmap # Should-Stop: $portmap # X-Start-Before: nis # X-Stop-After: nis # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # X-Interactive: true # Short-Description: Example initscript # Description: This file should be used to construct scripts to be # placed in /etc/init.d. ### END INIT INFO More information on the format is available from insserv(8). This information is used to dynamicaly assign sequence numbers to the boot scripts and to run the scripts in parallel during the boot. See also /usr/share/doc/insserv/README.Debian. maldet000066600000005746150770332110005754 0ustar00#!/usr/bin/env bash # # maldet Linux Malware Detect monitoring # # chkconfig: 345 70 30 # description: Linux Malware Detect file monitoring # processname: maldet ### BEGIN INIT INFO # Provides: maldet # 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: Start/stop maldet in monitor mode ### END INIT INFO inspath='/usr/local/maldetect' intcnf="$inspath/internals/internals.conf" if [ -f "$intcnf" ]; then source $intcnf source $cnf else echo "$intcnf not found." exit 1 fi # Source function library. if [ -f /etc/init.d/functions ]; then . /etc/init.d/functions elif [ -f /lib/lsb/init-functions ]; then . /lib/lsb/init-functions fi if [ -f "/etc/sysconfig/maldet" ]; then . /etc/sysconfig/maldet elif [ -f "/etc/default/maldet" ]; then . /etc/default/maldet fi if [ "$default_monitor_mode" ]; then MONITOR_MODE="$default_monitor_mode" fi RETVAL=0 prog="maldet" if [ -d /var/lock/subsys ]; then LOCKFILE=/var/lock/subsys/$prog else LOCKFILE=/var/lock/$prog fi if [ -z "$MONITOR_MODE" ]; then if [ -f /etc/redhat-release ]; then echo "error no default monitor mode defined, set \$MONITOR_MODE in /etc/sysconfig/maldet, or \$default_monitor_mode in $cnf" elif [ -f /etc/debian_version ]; then echo "error no default monitor mode defined, set \$MONITOR_MODE in /etc/default/maldet, or \$default_monitor_mode in $cnf" else echo "error no default monitor mode defined, set \$MONITOR_MODE in /etc/sysconfig/maldet, or \$default_monitor_mode in $cnf" fi exit 1 fi start() { echo -n "Starting $prog: " $inspath/maldet --monitor $MONITOR_MODE RETVAL=$? [ $RETVAL -eq 0 ] && touch $LOCKFILE echo return $RETVAL } stop() { echo -n "Shutting down $prog: " if [ -f /etc/redhat-release ]; then $inspath/maldet --kill-monitor && success || failure elif [ -f /etc/debian_version ]; then $inspath/maldet --kill-monitor && log_success_msg || log_failure_msg else $inspath/maldet --kill-monitor && success || failure fi RETVAL=$? [ $RETVAL -eq 0 ] && rm -f $LOCKFILE echo return $RETVAL } restart() { stop start } status() { echo -n "Checking $prog monitoring status: " if [ "$(pgrep -f inotify.paths.[0-9]+)" ]; then echo "Running" exit 0 else echo "Not running" exit 1 fi } case "$1" in start) start ;; stop) stop ;; status) status ;; restart) restart ;; condrestart) if [ -f $LOCKFILE ]; then restart fi ;; *) echo "Usage: $prog {start|stop|status|restart|condrestart}" exit 1 ;; esac exit $RETVAL module-init-tools000066600000002466150770332110010066 0ustar00#!/bin/sh -e ### BEGIN INIT INFO # Provides: module-init-tools # Required-Start: # Required-Stop: # Should-Start: checkroot # Should-Stop: # Default-Start: S # Default-Stop: # Short-Description: Process /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="/sbin:/bin" KVER=$(uname -r) KMAJ=${KVER%${KVER#*.*[!.]}} KMAJ=${KMAJ%.} if [ -e /etc/modules-$KVER ]; then MODULES_FILE=/etc/modules-$KVER elif [ -e /etc/modules-$KMAJ ]; then MODULES_FILE=/etc/modules-$KMAJ else MODULES_FILE=/etc/modules fi 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 } if [ "$VERBOSE" = no ]; then log_action_begin_msg 'Loading kernel modules' fi # Loop over every line in /etc/modules. grep '^[^#]' $MODULES_FILE | \ while read module args; do [ "$module" ] || continue load_module "$module" "$args" done if [ "$VERBOSE" = no ]; then log_action_end_msg 0 fi exit 0 modules_dep.sh000066600000001225150770332110007403 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: modules_dep # Required-Start: # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 6 # Short-Description: modules.dep creation. # Description: Create and destroy modules.dep. ### END INIT INFO case "$1" in start|"") if [ ! -d "/lib/modules/`uname -r`" ]; then mkdir /lib/modules/`uname -r` fi depmod -a >/dev/null 2>&1 ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) if [ -d "/lib/modules/`uname -r`" ]; then rm -rf /lib/modules/`uname -r` fi ;; *) echo "Usage: modules_dep.sh [start|stop]" >&2 exit 3 ;; esac : dovecot000066600000013100150770332110006130 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: dovecot # Required-Start: $local_fs $remote_fs $network $syslog $time # Required-Stop: $local_fs $remote_fs $network $syslog # Should-Start: postgresql mysql slapd winbind # Should-Stop: postgresql mysql slapd winbind # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Dovecot init script # Description: Init script for dovecot services ### END INIT INFO # Author: Miquel van Smoorenburg . # Modified for Debian GNU/Linux # by Ian Murdock . # # Do NOT "set -e" # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="IMAP/POP3 mail server" NAME=dovecot DAEMON=/usr/sbin/dovecot DAEMON_ARGS="" SCRIPTNAME=/etc/init.d/$NAME CONF=/etc/dovecot/${NAME}.conf # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 # Exit if the configuration file doesn't exist [ -f "$CONF" ] || exit 0 # Exit if explicitly told to [ "$ENABLED" != "0" ] || exit 0 # Allow core dumps if requested [ "$ALLOW_COREDUMPS" != "1" ] || ulimit -c unlimited # Define LSB log_* functions. # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions # conf file readable? if [ ! -r ${CONF} ]; then log_daemon_msg "${CONF}: not readable" "$NAME" && log_end_msg 1; exit 1; fi # dont check for inetd.conf if its not installed if [ -f /etc/inetd.conf ]; then # The init script should do nothing if dovecot or another imap/pop3 server # is being run from inetd, and dovecot is configured to run as an imap or # pop3 service for p in `sed -r "s/^ *(([^:]+|\[[^]]+]|\*):)?(pop3s?|imaps?)[ \t].*/\3/;t;d" \ /etc/inetd.conf` do for q in `sed -r "s/^[ \t]*protocols[ \t]*=[ \t]*(([^\"]*)|\"(.*)\")/\2\3/;t;d" \ ${CONF}` do if [ $p = $q ]; then exit 0 fi done done fi # determine the location of the PID file # overide by setting base_dir in conf file or PIDBASE in /etc/defaults/$NAME PIDBASE=${PIDBASE:-`sed -r "s/^[ \t]*base_dir[ \t]*=[ \t]*([^ \t]*)/\1/;t;d" ${CONF}`} PIDFILE=${PIDBASE:-/var/run/dovecot}/master.pid # # 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 -- -c ${CONF} > /dev/null \ || return 1 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- -c ${CONF} \ $DAEMON_ARGS \ || return 2 } # # 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=TERM/30/KILL/5 --pidfile $PIDFILE --name ${DAEMON##*/} 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/KILL/5 --pidfile $PIDFILE --name ${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 HUP --quiet --pidfile $PIDFILE --name $NAME return 0 } case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME" # Dovecot will kill itself if the system clock moves backwards # while Dovecot is running, and this can happen if the hardware # clock is severely out of sync at boot time, and then ntpd is # used to synchronize the system clock. So, if the machine also # runs ntpd, we call ntp-wait to make sure that ntpd has had a # chance to synchronize the system clock before Dovecot is # started. test -x /usr/sbin/ntp-wait && ntp-wait -n 2 || true do_start case "$?" in 0|1) log_end_msg 0 ;; 2) log_end_msg 1 ;; esac ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" do_stop case "$?" in 0|1) log_end_msg 0 ;; 2) log_end_msg 1 ;; esac ;; reload|force-reload) log_daemon_msg "Reloading $DESC" "$NAME" do_reload log_end_msg $? ;; restart) # # 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 ;; status) status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $? ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2 exit 3 ;; esac exit 0 .depend.start000066600000001362150770332110007145 0ustar00TARGETS = modules_dep.sh killprocs sysklogd saslauthd sudo clamav-freshclam mysql xinetd atd nginx sendmail ssh ntp apache2 maldet exim4 dovecot proftpd cron rmnologin rc.local INTERACTIVE = apache2 maldet clamav-freshclam: sysklogd mysql: sysklogd xinetd: sysklogd atd: sysklogd nginx: sysklogd sendmail: sysklogd ssh: sysklogd ntp: sysklogd apache2: sysklogd maldet: sysklogd exim4: sysklogd mysql dovecot: sysklogd mysql proftpd: sysklogd cron: sysklogd rmnologin: sudo clamav-freshclam sysklogd mysql xinetd apache2 atd exim4 nginx dovecot proftpd modules_dep.sh sendmail saslauthd ssh ntp cron maldet rc.local: sysklogd clamav-freshclam mysql xinetd apache2 atd exim4 nginx dovecot proftpd modules_dep.sh sendmail saslauthd sudo ssh ntp cron maldet sysklogd000066600000005204150770332110006332 0ustar00#! /bin/sh # /etc/init.d/sysklogd: start the system log daemon. ### BEGIN INIT INFO # Provides: sysklogd # Required-Start: $remote_fs $time # Required-Stop: $remote_fs $time # Should-Start: $network # Should-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: System logger ### END INIT INFO PATH=/bin:/usr/bin:/sbin:/usr/sbin pidfile=/var/run/syslogd.pid binpath=/sbin/syslogd test -x $binpath || exit 0 test ! -r /etc/default/syslogd || . /etc/default/syslogd . /lib/lsb/init-functions create_xconsole() { # Only proceed if /dev/xconsole is used at all if ! grep -q '^[^#].*/dev/xconsole' /etc/syslog.conf then return fi if [ ! -e /dev/xconsole ]; then mknod -m 640 /dev/xconsole p else chmod 0640 /dev/xconsole fi chown root:adm /dev/xconsole test ! -x /sbin/restorecon || /sbin/restorecon /dev/xconsole } running() { # No pidfile, probably no daemon present # if [ ! -f $pidfile ] then return 1 fi pid=`cat $pidfile` # No pid, probably no daemon present # if [ -z "$pid" ] then return 1 fi if [ ! -d /proc/$pid ] then return 1 fi cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1` # No syslogd? # if [ "$cmd" != "$binpath" ] then return 1 fi return 0 } case "$1" in start) log_begin_msg "Starting system log daemon..." create_xconsole start-stop-daemon --start --quiet --pidfile $pidfile --name syslogd --startas $binpath -- $SYSLOGD log_end_msg $? test -d /lib/init/rw/sendsigs.omit.d || mkdir -p /lib/init/rw/sendsigs.omit.d test ! -f /lib/init/rw/sendsigs.omit.d/sysklogd || rm -f /lib/init/rw/sendsigs.omit.d/sysklogd ln -s $pidfile /lib/init/rw/sendsigs.omit.d/sysklogd ;; stop) log_begin_msg "Stopping system log daemon..." start-stop-daemon --stop --quiet --pidfile $pidfile --name syslogd log_end_msg $? ;; reload|force-reload) log_begin_msg "Reloading system log daemon..." start-stop-daemon --stop --quiet --signal 1 --pidfile $pidfile --name syslogd log_end_msg $? ;; restart) log_begin_msg "Restarting system log daemon..." start-stop-daemon --stop --retry 5 --quiet --pidfile $pidfile --name syslogd start-stop-daemon --start --quiet --pidfile $pidfile --name syslogd --startas $binpath -- $SYSLOGD log_end_msg $? ;; reload-or-restart) if running then $0 reload else $0 start fi ;; *) log_success_msg "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload|reload-or-restart}" exit 1 esac exit 0 mountkernfs.sh000066600000003604150770332110007461 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: mountkernfs # Required-Start: # Required-Stop: # Should-Start: glibc # Default-Start: S # Default-Stop: # Short-Description: Mount kernel virtual file systems. # Description: Mount initial set of virtual filesystems the kernel # provides and that are required by everything. ### END INIT INFO PATH=/sbin:/bin . /lib/init/vars.sh . /lib/lsb/init-functions . /lib/init/mount-functions.sh [ -f /etc/default/tmpfs ] && . /etc/default/tmpfs do_start () { # # Get some writable area available before the root is checked # and remounted. # RW_OPT= [ "${RW_SIZE:=$TMPFS_SIZE}" ] && RW_OPT=",size=$RW_SIZE" domount tmpfs "" /lib/init/rw tmpfs -omode=0755,nosuid$RW_OPT touch /lib/init/rw/.ramfs # Make pidfile omit directory for sendsigs mkdir /lib/init/rw/sendsigs.omit.d/ # # Mount proc filesystem on /proc # domount proc "" /proc proc -onodev,noexec,nosuid # # Mount sysfs on /sys # # Only mount sysfs if it is supported (kernel >= 2.6) if grep -E -qs "sysfs\$" /proc/filesystems then domount sysfs "" /sys sysfs -onodev,noexec,nosuid fi # Mount /var/run and /var/lock as tmpfs if enabled if [ yes = "$RAMRUN" ] ; then RUN_OPT= [ "${RUN_SIZE:=$TMPFS_SIZE}" ] && RUN_OPT=",size=$RUN_SIZE" domount tmpfs "" /var/run varrun -omode=0755,nosuid$RUN_OPT touch /var/run/.ramfs fi if [ yes = "$RAMLOCK" ] ; then LOCK_OPT= [ "${LOCK_SIZE:=$TMPFS_SIZE}" ] && LOCK_OPT=",size=$LOCK_SIZE" domount tmpfs "" /var/lock varlock -omode=1777,nodev,noexec,nosuid$LOCK_OPT touch /var/lock/.ramfs fi } case "$1" in "") echo "Warning: mountkernfs should be called with the 'start' argument." >&2 do_start ;; start) do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; *) echo "Usage: mountkernfs [start|stop]" >&2 exit 3 ;; esac rsync000066600000010457150770332110005637 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: rsyncd # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Should-Start: $named # 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]) RSYNC_NICE_PARM="--nicelevel $RSYNC_NICE";; x[1-9][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 --pidfile $RSYNC_PID_FILE log_end_msg $? 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 --pidfile $RSYNC_PID_FILE || true sleep 1 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 xinetd000066600000004017150770332110005767 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: inetd # Required-Start: $local_fs $remote_fs # Required-Stop: $local_fs $remote_fs # Should-Start: $syslog # Should-Stop: $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start or stop the xinetd daemon. ### END INIT INFO # clear poisonned environment unset TMPDIR NAME=xinetd DAEMON=/usr/sbin/$NAME PIDFILE=/var/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 --start --quiet --background --exec "$DAEMON" -- \ -pidfile "$PIDFILE" $XINETD_OPTS log_end_msg $? ;; stop) log_daemon_msg "Stopping internet superserver" "$NAME" start-stop-daemon --stop --signal 3 --quiet --oknodo --exec "$DAEMON" log_end_msg $? ;; reload) log_daemon_msg "Reloading internet superserver configuration" "$NAME" start-stop-daemon --stop --signal 1 --quiet --oknodo --exec "$DAEMON" log_end_msg $? ;; restart|force-reload) $0 stop $0 start ;; *) echo "Usage: /etc/init.d/xinetd {start|stop|reload|force-reload|restart}" exit 1 ;; esac exit 0 sudo000066600000001047150770332110005446 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: sudo # Required-Start: $local_fs $remote_fs # Required-Stop: # X-Start-Before: rmnologin # Default-Start: 2 3 4 5 # Default-Stop: ### END INIT INFO N=/etc/init.d/sudo set -e case "$1" in start) # make sure privileges don't persist across reboots if [ -d /var/lib/sudo ] then find /var/lib/sudo -exec touch -t 198501010000 '{}' \; fi ;; stop|reload|restart|force-reload) ;; *) echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0 bind9000066600000006217150770332110005505 0ustar00#!/bin/sh -e ### BEGIN INIT INFO # Provides: bind9 # Required-Start: $remote_fs # Required-Stop: $remote_fs # Should-Start: $network $syslog # Should-Stop: $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start and stop bind9 # Description: bind9 is a Domain Name Server (DNS) # which translates ip addresses to and from internet names ### END INIT INFO PATH=/sbin:/bin:/usr/sbin:/usr/bin # for a chrooted server: "-u bind -t /var/lib/named" # Don't modify this line, change or create /etc/default/bind9. OPTIONS="" RESOLVCONF=no test -f /etc/default/bind9 && . /etc/default/bind9 test -x /usr/sbin/rndc || exit 0 . /lib/lsb/init-functions PIDFILE=/var/run/named/named.pid check_network() { if [ -x /usr/bin/uname ] && [ "X$(/usr/bin/uname -o)" = XSolaris ]; then IFCONFIG_OPTS="-au" else IFCONFIG_OPTS="" fi if [ -z "$(/sbin/ifconfig $IFCONFIG_OPTS)" ]; then #log_action_msg "No networks configured." return 1 fi return 0 } case "$1" in start) log_daemon_msg "Starting domain name service..." "bind9" modprobe capability >/dev/null 2>&1 || true # dirs under /var/run can go away on reboots. mkdir -p /var/run/named chmod 775 /var/run/named chown root:bind /var/run/named >/dev/null 2>&1 || true if [ ! -x /usr/sbin/named ]; then log_action_msg "named binary missing - not starting" log_end_msg 1 fi if ! check_network; then log_action_msg "no networks configured" log_end_msg 1 fi if start-stop-daemon --start --oknodo --quiet --exec /usr/sbin/named \ --pidfile ${PIDFILE} -- $OPTIONS; then if [ "X$RESOLVCONF" != "Xno" ] && [ -x /sbin/resolvconf ] ; then echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo.named fi log_end_msg 0 else log_end_msg 1 fi ;; stop) log_daemon_msg "Stopping domain name service..." "bind9" if ! check_network; then log_action_msg "no networks configured" log_end_msg 1 fi if [ "X$RESOLVCONF" != "Xno" ] && [ -x /sbin/resolvconf ] ; then /sbin/resolvconf -d lo.named fi pid=$(/usr/sbin/rndc stop -p | awk '/^pid:/ {print $2}') || true if [ -z "$pid" ]; then # no pid found, so either not running, or error pid=$(pgrep -f ^/usr/sbin/named) || true start-stop-daemon --stop --oknodo --quiet --exec /usr/sbin/named \ --pidfile ${PIDFILE} -- $OPTIONS fi if [ -n $pid ]; then while kill -0 $pid 2>/dev/null; do log_progress_msg "waiting for pid $pid to die" sleep 1 done fi log_end_msg 0 ;; reload|force-reload) log_daemon_msg "Reloading domain name service..." "bind9" if ! check_network; then log_action_msg "no networks configured" log_end_msg 1 fi /usr/sbin/rndc reload >/dev/null && log_end_msg 0 || log_end_msg 1 ;; restart) if ! check_network; then log_action_msg "no networks configured" exit 1 fi $0 stop $0 start ;; status) ret=0 status_of_proc -p ${PIDFILE} /usr/sbin/named bind9 2>/dev/null || ret=$? exit $ret ;; *) log_action_msg "Usage: /etc/init.d/bind9 {start|stop|reload|restart|force-reload|status}" exit 1 ;; esac exit 0 keymap.sh000066600000007101150770332110006370 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: keymap # Required-Start: mountdevsubfs # Required-Stop: # Default-Start: S # Default-Stop: # X-Interactive: true # Short-Description: Set keymap # Description: Set the Console keymap ### END INIT INFO # If setupcon is present, then we've been superseded by console-setup. if type setupcon >/dev/null 2>&1; then exit 0 fi . /lib/lsb/init-functions # Avoid messing with splashy boot # Thanks to John Hughes and Marc Haber for suggestions pidof splashy >/dev/null && mkdir -p /lib/init/rw/splashy/ && touch /lib/init/rw/splashy/splashy-stopped-keymap && exit 0 # # Load the keymaps *as soon as possible* # # Don't fail on error CONSOLE_TYPE=`fgconsole 2>/dev/null` || CONSOLE_TYPE="unknown" # Don't fail on serial consoles QUIT=0 # fail silently if loadkeys not present (yet). command -v loadkeys >/dev/null 2>&1 || QUIT=1 CONFDIR=/etc/console CONFFILEROOT=boottime EXT=kmap CONFFILE=${CONFDIR}/${CONFFILEROOT}.${EXT}.gz reset_kernel() { # On Mac PPC machines, we may need to set kernel vars first # We need to mount /proc to do that; not optimal, as its going to # be mounted in S10checkroot, but we need it set up before sulogin # may be run in checkroot, which will need the keyboard to log in... [ -x /sbin/sysctl ] || return [ -r /etc/sysctl.conf ] || return grep -v '^\#' /etc/sysctl.conf | grep -q keycodes if [ "$?" = "0" ] ; then grep keycodes /etc/sysctl.conf | grep -v "^#" | while read d ; do /sbin/sysctl -w $d 2> /dev/null || true done fi } unicode_start_stop() { # Switch unicode mode by checking the locale. # This will be needed before loading the keymap. [ -x /usr/bin/unicode_start ] || [ -x /bin/unicode_start ] || return [ -x /usr/bin/unicode_stop ] || [ -x /bin/unicode_stop ] || return ENV_FILE="" [ -r /etc/environment ] && ENV_FILE="/etc/environment" [ -r /etc/default/locale ] && ENV_FILE="/etc/default/locale" [ "$ENV_FILE" ] && CHARMAP=$(set -a && . "$ENV_FILE" && locale charmap) if [ "$CHARMAP" = "UTF-8" ]; then unicode_start 2> /dev/null || true else unicode_stop 2> /dev/null || true fi } if [ ! $QUIT = '1' ] ; then case "$1" in start | restart | force-reload | reload) # Set kernel variables if required reset_kernel # First mount /proc if necessary...and if it is there (#392798) unmount_proc="no" if [ -d /proc ]; then if [ ! -x /proc/$$ ]; then unmount_proc="yes" mount -n /proc fi if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ] ; then linux_keycodes=`cat /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes` else linux_keycodes=1; fi else linux_keycodes=1; fi # load new map if [ $linux_keycodes -gt 0 ] ; then if [ -r ${CONFFILE} ] ; then # Switch console mode to UTF-8 or ASCII as necessary unicode_start_stop if [ $CONSOLE_TYPE = "serial" ] ; then loadkeys -q ${CONFFILE} 2>&1 > /dev/null else loadkeys -q ${CONFFILE} fi if [ $? -gt 0 ] then # if we've a serial console, we may not have a keyboard, so don't # complain if we fail. if [ ! $CONSOLE_TYPE = "serial" ]; then log_warning_msg "Problem when loading ${CONFDIR}/${CONFFILEROOT}.${EXT}.gz, use install-keymap" sleep 10 fi fi fi fi # unmount /proc if we mounted it [ "$unmount_proc" = "no" ] || umount -n /proc ;; stop) ;; *) log_warning_msg "Usage: $0 {start|stop|restart|reload|force-reload}" ;; esac fi saslauthd000066600000017601150770332110006467 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: saslauthd # Required-Start: $local_fs $remote_fs # Required-Stop: $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 1 # Short-Description: saslauthd startup script # Description: This script starts the saslauthd daemon. It is # configured using the file /etc/default/saslauthd. ### END INIT INFO # Author: Fabian Fagerholm # Do NOT "set -e" # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin # Global variables DAEMON=/usr/sbin/saslauthd DEFAULT_FILES=`find /etc/default -regex '/etc/default/saslauthd[_a-zA-Z0-9\-]*$' -print | sort` # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 # 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 all saslauthd instances # Parameters: none # Return value: none do_startall() { for instance in $DEFAULT_FILES do start_instance $instance done } # Function that stops all saslauthd instances # Parameters: none # Return value: none do_stopall() { for instance in $DEFAULT_FILES do stop_instance $instance done } # Function that sends a SIGHUP to all saslauthd instances # Parameters: none # Return value: none do_reloadall() { for instance in $DEFAULT_FILES do reload_instance $instance done } # Function that starts a single saslauthd instance # Parameters: # $1 = path of default file for this instance # Return value: # 0 on success (does not mean the instance started) # 1 on failure start_instance() { # Load defaults file for this instance. . $1 # If the daemon is not enabled, give the user a warning and stop. if [ "$START" != "yes" ]; then log_warning_msg "To enable $NAME, edit $1 and set START=yes" return 0 fi # If the short name of this instance is undefined, warn the user # but choose a default name. if [ -z "$NAME" ]; then log_warning_msg "Short name (NAME) undefined in $1, using default" NAME=default fi log_daemon_msg "Starting $DESC" "$NAME" # Determine run directory and pid file location by looking # for an -m option. RUN_DIR=`echo "$OPTIONS" | xargs -n 1 echo | sed -n '/^-m$/{n;p}'` if [ -z "$RUN_DIR" ]; then # No run directory defined in defaults file, fail. log_failure_msg "No run directory defined for $NAME, not starting" return 1 fi PIDFILE=$RUN_DIR/saslauthd.pid # If no mechanisms are defined, fail. if [ -z "$MECHANISMS" ]; then log_failure_msg "No mechanisms defined in $1, not starting $NAME" return 1 fi # If there are mechanism options defined, prepare them for use with # the -O flag. if [ -n "$MECH_OPTIONS" ]; then MECH_OPTIONS="-O $MECH_OPTIONS" fi # If there is a threads option defined, prepare it for use with # the -n flag. if [ -n "$THREADS" ]; then THREAD_OPTIONS="-n $THREADS" fi # Construct argument string. DAEMON_ARGS="-a $MECHANISMS $MECH_OPTIONS $OPTIONS $THREAD_OPTIONS" # If there is a statoverride for the run directory, then pull # permission and ownership information from it and create the directory. # Otherwise, we create the directory with default permissions and # ownership (root:sasl, 710). if dpkg-statoverride --list $RUN_DIR > /dev/null; then createdir `dpkg-statoverride --list $RUN_DIR` else createdir root sasl 710 $RUN_DIR fi # Start the daemon, phase 1: see if it is already running. start-stop-daemon --start --quiet --pidfile $PIDFILE --name $NAME \ --exec $DAEMON --test > /dev/null if [ "$?" != "0" ]; then log_progress_msg "(already running)" log_end_msg 0 return 0 fi # Start the daemon, phase 2: it was not running, so actually start it now. start-stop-daemon --start --quiet --pidfile $PIDFILE --name $NAME \ --exec $DAEMON -- $DAEMON_ARGS if [ "$?" -ne "0" ]; then log_end_msg 1 return 1 fi # Started successfully. log_end_msg 0 return 0 } # Function that stops a single saslauthd instance # Parameters: # $1 = path of default file for this instance # Return value: # 0 on success (daemon was stopped) # 1 if the daemon was already stopped # 2 if the daemon could not be stopped stop_instance() { # Load defaults file for this instance. . $1 # If the short name of this instance is undefined, warn the user # but choose a default name. if [ -z "$NAME" ]; then log_warning_msg "Short name (NAME) undefined in $1, using default" NAME=default fi # Determine run directory and pid file location by looking # for an -m option. RUN_DIR=`echo "$OPTIONS" | xargs -n 1 echo | sed -n '/^-m$/{n;p}'` if [ -z "$RUN_DIR" ]; then # No run directory defined in defaults file, fail. log_failure_msg "No run directory defined for $NAME, cannot stop" return 2 fi PIDFILE=$RUN_DIR/saslauthd.pid log_daemon_msg "Stopping $DESC" "$NAME" start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \ --pidfile $PIDFILE --exec $DAEMON if [ "$?" -eq "2" ]; then # Failed to stop. log_end_msg 1 return 2 fi if [ "$?" -eq "1" ]; then # Already stopped. log_progress_msg "(not running)" fi # Many daemons don't delete their pidfiles when they exit. rm -f $PIDFILE # Stopped successfully. log_end_msg 0 return $RETVAL } # Function that sends a SIGHUP to a single saslauthd instance # Parameters: # $1 = path of default file for this instance # Return value: # 0 on success (does not mean the daemon was reloaded) # other values on failure reload_instance() { # Load defaults file for this instance. . $1 # If the short name of this instance is undefined, warn the user # but choose a default name. if [ -z "$NAME" ]; then log_warning_msg "Short name (NAME) undefined in $1, using default" NAME=default fi # Determine run directory and pid file location by looking # for an -m option. RUN_DIR=`echo "$OPTIONS" | xargs -n 1 echo | sed -n '/^-m$/{n;p}'` if [ -z "$RUN_DIR" ]; then # No run directory defined in defaults file, fail. log_failure_msg "No run directory defined for $NAME, cannot reload" return 2 fi PIDFILE=$RUN_DIR/saslauthd.pid log_daemon_msg "Reloading $DESC" "$NAME" # Reload the daemon. First, see if it is already running. start-stop-daemon --start --quiet --pidfile $PIDFILE \ --exec $DAEMON --test > /dev/null if [ "$?" -eq "0" ]; then # Not running, signal this and stop. log_progress_msg "(not running)" log_end_msg 0 return 0 fi start-stop-daemon --stop --signal 1 \ --pidfile $PIDFILE --exec $DAEMON log_end_msg $? } # Function that creates a directory with the specified # ownership and permissions # Parameters: # $1 = user # $2 = group # $3 = permissions (octal) # $4 = path to directory # Return value: none createdir() { # In the future, use -P/-Z to have SE Linux enhancement install -d --group="$2" --mode="$3" --owner="$1" "$4" } # Action switch case "$1" in start) do_startall ;; stop) do_stopall ;; reload|force-reload) do_reloadall ;; restart) do_stopall do_startall ;; start-instance) if [ -f /etc/default/$2 ]; then start_instance /etc/default/$2 else log_failure_msg "Instance $2 does not exist." fi ;; stop-instance) if [ -f /etc/default/$2 ]; then stop_instance /etc/default/$2 else log_failure_msg "Instance $2 does not exist." fi ;; reload-instance|force-reload-instance) if [ -f /etc/default/$2 ]; then reload_instance /etc/default/$2 else log_failure_msg "Instance $2 does not exist." fi ;; restart-instance) if [ -f /etc/default/$2 ]; then stop_instance /etc/default/$2 start_instance /etc/default/$2 else log_failure_msg "Instance $2 does not exist." fi ;; *) SCRIPTNAME=$0 echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 echo " or {start-instance|stop-instance|restart-instance|" >&2 echo " reload-instance|force-reload-instance} " \ "" >&2 exit 3 ;; esac : mountnfs-bootclean.sh000066600000001164150770332110010722 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: mountnfs-bootclean # Required-Start: $local_fs mountnfs # Required-Stop: # Default-Start: S # Default-Stop: # Short-Description: bootclean after mountnfs. # Description: Clean temporary filesystems after # network filesystems have been mounted. ### END INIT INFO case "$1" in start|"") # Clean /tmp, /var/lock, /var/run . /lib/init/bootclean.sh ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; *) echo "Usage: mountnfs-bootclean.sh [start|stop]" >&2 exit 3 ;; esac : rmnologin000066600000002062150770332110006476 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: rmnologin # Required-Start: $remote_fs $all # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Remove /etc/nologin at boot # Description: This script removes the /etc/nologin file as the # last step in the boot process, if DELAYLOGIN=yes. # If DELAYLOGIN=no, /etc/nologin was not created by # bootmisc earlier in the boot process. ### END INIT INFO PATH=/sbin:/bin [ "$DELAYLOGIN" ] || DELAYLOGIN=yes . /lib/init/vars.sh do_start () { # # If login delaying is enabled then remove the flag file # case "$DELAYLOGIN" in Y*|y*) rm -f /var/lib/initscripts/nologin ;; esac } do_status () { if [ ! -f /var/lib/initscripts/nologin ] ; then return 0 else return 4 fi } case "$1" in start) do_start ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2 exit 3 ;; stop) # No-op ;; status) do_status exit $? ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac : mtab.sh000066600000007101150770332110006025 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: mtab # Required-Start: checkroot # Required-Stop: # Default-Start: S # Default-Stop: # Short-Description: Update mtab file. # Description: Update the mount program's mtab file after # all local filesystems have been mounted. ### END INIT INFO # # The main purpose of this script is to update the mtab file to reflect # the fact that virtual filesystems were mounted early on, before mtab # was writable. # PATH=/sbin:/bin . /lib/init/vars.sh TTYGRP=5 TTYMODE=620 [ -f /etc/default/devpts ] && . /etc/default/devpts TMPFS_SIZE= [ -f /etc/default/tmpfs ] && . /etc/default/tmpfs KERNEL="$(uname -s)" . /lib/lsb/init-functions . /lib/init/mount-functions.sh # $1 - fstype # $2 - mount point # $3 - mount name/device # $4 - mount options domtab () { # Directory present? if [ ! -d $2 ] then return fi # Not mounted? if ! mountpoint -q $2 < /dev/null then return fi if [ -n "$3" ] then NAME="$3" else NAME="$1" fi # Already recorded? if ! grep -E -sq "^([^ ]+) +$2 +" /etc/mtab < /dev/null then mount -f -t $1 $OPTS $4 $NAME $2 < /dev/null fi } do_start () { DO_MTAB="" MTAB_PATH="$(readlink -f /etc/mtab || :)" case "$MTAB_PATH" in /proc/*) # Assume that /proc/ is not writable ;; /*) # Only update mtab if it is known to be writable # Note that the touch program is in /usr/bin #if ! touch "$MTAB_PATH" >/dev/null 2>&1 #then # return #fi ;; "") [ -L /etc/mtab ] && MTAB_PATH="$(readlink /etc/mtab)" if [ "$MTAB_PATH" ] then log_failure_msg "Cannot initialize ${MTAB_PATH}." else log_failure_msg "Cannot initialize /etc/mtab." fi ;; *) log_failure_msg "Illegal mtab location '${MTAB_PATH}'." ;; esac # # Initialize mtab file if necessary # if [ ! -f /etc/mtab ] then :> /etc/mtab chmod 644 /etc/mtab fi if selinux_enabled && [ -x /sbin/restorecon ] && [ -r /etc/mtab ] then restorecon /etc/mtab fi # S02mountkernfs.sh RW_OPT= [ "${RW_SIZE:=$TMPFS_SIZE}" ] && RW_OPT=",size=$RW_SIZE" domtab tmpfs /lib/init/rw tmpfs -omode=0755,nosuid$RW_OPT domtab proc /proc "proc" -onodev,noexec,nosuid if grep -E -qs "sysfs\$" /proc/filesystems then domtab sysfs /sys sysfs -onodev,noexec,nosuid fi if [ yes = "$RAMRUN" ] ; then RUN_OPT= [ "${RUN_SIZE:=$TMPFS_SIZE}" ] && RUN_OPT=",size=$RUN_SIZE" domtab tmpfs /var/run "varrun" -omode=0755,nosuid$RUN_OPT fi if [ yes = "$RAMLOCK" ] ; then LOCK_OPT= [ "${LOCK_SIZE:=$TMPFS_SIZE}" ] && LOCK_OPT=",size=$LOCK_SIZE" domtab tmpfs /var/lock "varlock" -omode=1777,nodev,noexec,nosuid$LOCK_OPT fi if [ -d /proc/bus/usb ] then domtab usbfs /proc/bus/usb "procbususb" fi # S03udev domtab tmpfs /dev "udev" -omode=0755 # S04mountdevsubfs SHM_OPT= [ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=",size=$SHM_SIZE" domtab tmpfs /dev/shm tmpfs -onosuid,nodev$SHM_OPT domtab devpts /dev/pts "devpts" -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE # Add everything else in /proc/mounts into /etc/mtab, with # special exceptions. exec 9<&0 0&2 exit 3 ;; stop) # No-op ;; *) echo "Usage: mountall-mtab.sh [start|stop]" >&2 exit 3 ;; esac : .depend.stop000066600000001724150770332110006777 0ustar00TARGETS = modules_dep.sh urandom saslauthd clamav-freshclam xinetd atd nginx sendmail apache2 maldet exim4 dovecot proftpd mysql quota sysklogd sendsigs hwclock.sh umountnfs.sh networking ifupdown umountfs umountroot halt reboot mysql: exim4 dovecot sysklogd: clamav-freshclam mysql xinetd apache2 atd exim4 nginx dovecot proftpd sendmail maldet sendsigs: clamav-freshclam mysql xinetd apache2 atd quota exim4 nginx sysklogd dovecot proftpd maldet hwclock.sh: mysql atd sysklogd umountnfs.sh: sendsigs clamav-freshclam mysql xinetd apache2 atd quota exim4 nginx sysklogd dovecot proftpd maldet networking: mysql umountnfs.sh apache2 exim4 nginx sysklogd dovecot proftpd maldet ifupdown: mysql umountnfs.sh apache2 exim4 networking nginx sysklogd dovecot proftpd maldet umountfs: ifupdown clamav-freshclam hwclock.sh mysql xinetd umountnfs.sh apache2 atd quota exim4 urandom networking nginx sysklogd dovecot proftpd maldet umountroot: umountfs halt: umountroot reboot: umountroot .depend.boot000066600000003360150770332110006753 0ustar00TARGETS = mountkernfs.sh udev mountdevsubfs.sh bootlogd hwclockfirst.sh hdparm hostname.sh ifupdown-clean hwclock.sh module-init-tools mtab.sh checkfs.sh ifupdown mountall.sh mountall-bootclean.sh mountoverflowtmp networking urandom udev-mtab procps mountnfs.sh mountnfs-bootclean.sh console-screen.sh quota bootmisc.sh screen-cleanup stop-bootlogd-single INTERACTIVE = udev checkfs.sh console-screen.sh udev: mountkernfs.sh mountdevsubfs.sh: mountkernfs.sh udev bootlogd: mountdevsubfs.sh hwclockfirst.sh: mountdevsubfs.sh bootlogd hdparm: mountdevsubfs.sh udev bootlogd hostname.sh: bootlogd hwclock.sh: bootlogd checkfs.sh: mtab.sh ifupdown: ifupdown-clean mountall.sh: checkfs.sh mountall-bootclean.sh: mountall.sh mountoverflowtmp: mountall-bootclean.sh networking: mountkernfs.sh mountall.sh mountoverflowtmp ifupdown urandom: mountall.sh mountoverflowtmp udev-mtab: udev mountall.sh mountoverflowtmp procps: bootlogd mountkernfs.sh mountall.sh mountoverflowtmp udev module-init-tools mountnfs.sh: mountall.sh mountoverflowtmp networking ifupdown mountnfs-bootclean.sh: mountall.sh mountoverflowtmp mountnfs.sh console-screen.sh: mountall.sh mountoverflowtmp mountnfs.sh mountnfs-bootclean.sh quota: mountall.sh mountoverflowtmp mountnfs.sh mountnfs-bootclean.sh bootmisc.sh: mountall.sh mountoverflowtmp mountnfs.sh mountnfs-bootclean.sh udev screen-cleanup: mountall.sh mountoverflowtmp mountnfs.sh mountnfs-bootclean.sh stop-bootlogd-single: mountall.sh mountoverflowtmp udev console-screen.sh ifupdown ifupdown-clean mountnfs.sh mountnfs-bootclean.sh hwclock.sh networking quota urandom mountkernfs.sh hwclockfirst.sh mountdevsubfs.sh udev-mtab module-init-tools checkfs.sh bootmisc.sh hdparm mtab.sh screen-cleanup bootlogd hostname.sh procps mountall-bootclean.sh quota000066600000006025150770332110005626 0ustar00#!/bin/sh ### BEGIN INIT INFO # Provides: quota # Short-Description: Enable user quota # Required-Start: $remote_fs # Required-Stop: $remote_fs # Default-Start: S # Default-Stop: 0 6 ### END INIT INFO PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DESC="quota service" # names of binaries check=/sbin/quotacheck on=/sbin/quotaon off=/sbin/quotaoff quotaisoff=/var/lib/quota/off quotaisnew=/var/lib/quota/new ALLFLAGS=-aug CHECKFLAGS=${ALLFLAGS}m USERFLAGS=-uc GROUPFLAGS=-gc . /lib/lsb/init-functions # create list of all fs with quota scan_fstab() { tmplist=`grep "^[ ]*[^#].*$1" /etc/fstab | \ sed -e 's/\(^[[:space:]]*[^[:space:]]*[[:space:]]*[^[:space:]]*[[:space:]]*[^[:space:]]*\).*/\1/g' \ -e 's/^[[:space:]]*[^[:space:]]*[[:space:]]*//g'` list=${tmplist:=empty} } set -e case "$1" in start) # Check if quota already has been enabled LC_MESSAGES=C $on -ap|grep -q "is off" || exit 0 # Check all filesystems if quota is new or wasn't shut down correctly log_action_begin_msg 'Checking quotas'; if [ -x $check ] && ( [ ! -f $quotaisoff ] || [ -f $quotaisnew ] ); then $check $CHECKFLAGS || $check -c $CHECKFLAGS log_action_end_msg 0 else # if some filesystems are new check just these filesystems scan_fstab "usrquota" set -- $list while [ $# -ge 2 ] do if [ "$2" != "xfs" ] then if test ! -e $1/quota.user && test ! -e $1/aquota.user; then log_warning_msg "Warning: user quota not configured in filesystem \`$1.'" elif test ! -e $1/aquota.user; then test ! -s $1/quota.user && $check $USERFLAGS $1 elif test ! -s $1/aquota.user; then $check $USERFLAGS $1 fi fi shift; shift done scan_fstab "grpquota" set $list while [ $# -ge 2 ] do if [ "$2" != "xfs" ] then if test ! -e $1/quota.group && test ! -e $1/aquota.group; then log_warning_msg "Warning: group quota not configured in filesystem \`$1.'" elif test ! -e $1/aquota.group; then test ! -s $1/quota.group && $check $GROUPFLAGS $1 elif test ! -s $1/aquota.group; then $check $GROUPFLAGS $1 fi fi shift; shift done log_action_end_msg 0 fi # Remove quota-off and quota-new files rm -f $quotaisoff $quotaisnew # Turn quotas on. if [ -x $on ] then log_action_begin_msg 'Turning on quotas'; $on $ALLFLAGS log_action_end_msg 0 fi ;; stop) if [ -x $off ] then log_action_begin_msg 'Turning off quotas' $off $ALLFLAGS || true # Create quota-on file touch $quotaisoff log_action_end_msg 0 fi ;; restart|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". # $0 stop $0 start ;; status) if LC_MESSAGES=C $on -ap | grep -q "is off"; then log_failure_msg "quota is off" exit 3 else log_success_msg "quota is on" exit 0 fi ;; *) echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2 exit 1 ;; esac exit 0 udev000066600000016632150770332110005445 0ustar00#!/bin/sh -e ### BEGIN INIT INFO # Provides: udev # Required-Start: mountkernfs # Required-Stop: # Default-Start: S # Default-Stop: # X-Interactive: true # Short-Description: Start udevd, populate /dev and load drivers. ### END INIT INFO # we need to unmount /dev/pts/ and remount it later over the tmpfs 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 tmpfs over /dev, if somebody did not already do it mount_tmpfs() { if grep -E -q "^[^[:space:]]+ /dev (dev)?tmpfs" /proc/mounts; then mount -n -o remount,${dev_mount_options} -t tmpfs tmpfs /dev return fi if ! mount -n -o $dev_mount_options -t tmpfs tmpfs /dev; then log_failure_msg "udev requires tmpfs 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 } supported_kernel() { case "$(uname -r)" in 2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;; 2.6.1[0-9]|2.6.1[0-9][!0-9]*) return 1 ;; 2.6.2[0-5]|2.6.2[0-5][!0-9]*) return 1 ;; esac return 0 } # 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 } create_dev_root_rule() { local udevroot="$1" [ -e $udevroot/rules.d/61-dev-root-link.rules ] && return 0 eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/ \ || true) [ "$ROOT_MAJOR" -a "$ROOT_MINOR" ] || return 0 echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' \ > $udevroot/root-link-rule mv $udevroot/root-link-rule $udevroot/rules.d/61-dev-root-link.rules } ############################################################################## [ -x /sbin/udevd ] || exit 0 PATH="/sbin:/bin" # defaults tmpfs_size="10M" udev_root="/dev" if [ -e /etc/udev/udev.conf ]; then . /etc/udev/udev.conf fi . /lib/lsb/init-functions if ! supported_kernel; then log_failure_msg "udev requires a kernel >= 2.6.26, not started." log_end_msg 1 fi if [ ! -e /proc/filesystems ]; then log_failure_msg "udev requires a mounted procfs, not started." log_end_msg 1 fi if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then log_failure_msg "udev requires tmpfs 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 [ ! -e /sys/kernel/uevent_helper ]; then log_failure_msg "udev requires hotplug support, not started." log_end_msg 1 fi ############################################################################## # this is experimental and may not work well if [ "$UDEV_DISABLED" = "yes" ]; then udev_root=/etc/udev/.dev export UDEV_ROOT=$udev_root fi udev_root=${udev_root%/} dev_mount_options='mode=0755' if [ "$tmpfs_size" ]; then dev_mount_options="size=${tmpfs_size},${dev_mount_options}" fi if [ "$udev_root" != "/dev" ]; then log_warning_msg "udev_root != /dev/" case "$1" in start) if [ -e "$udev_root/.udev/" ]; then if mountpoint -q $udev_root/; then log_failure_msg "udev is already active on $udev_root." log_end_msg 1 else log_warning_msg ".udev/ already exists on the static $udev_root!" fi fi echo > /sys/kernel/uevent_helper mount -n -o $dev_mount_options -t tmpfs tmpfs $udev_root log_daemon_msg "Starting the hotplug events dispatcher" "udevd" if udevd --daemon; then log_end_msg $? else log_end_msg $? fi mkdir -p $udev_root/.udev/rules.d/ create_dev_root_rule $udev_root/.udev/ log_action_begin_msg "Synthesizing initial hotplug events" if udevadm trigger --action=add; then log_action_end_msg $? else log_action_end_msg $? fi ;; stop) log_daemon_msg "Stopping the hotplug events dispatcher" "udevd" if start-stop-daemon --stop --name udevd --quiet --oknodo --retry 5; then log_end_msg $? else log_end_msg $? fi log_action_begin_msg "Unmounting $udev_root" # unmounting with -l should never fail if umount -n -l $udev_root; then log_action_end_msg $? else log_action_end_msg $? fi ;; restart) $0 stop $0 start ;; reload|force-reload) udevadm control --reload-rules ;; *) echo "Usage: /etc/init.d/udev {start|stop|restart|reload|force-reload}" exit 1 ;; esac exit 0 fi # udev_root != /dev ############################################################################## # 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 "$udev_root/.udev/" ]; then if mountpoint -q $udev_root/; then TMPFS_MOUNTED=1 else log_warning_msg ".udev/ already exists on the static $udev_root!" fi else warn_if_interactive fi echo > /sys/kernel/uevent_helper if [ -z "$TMPFS_MOUNTED" ]; then unmount_devpts mount_tmpfs [ -d /proc/1 ] || mount -n /proc else # and clean up the database of the initramfs udev rm -rf /dev/.udev/ fi # set the SELinux context for devices created in the initramfs [ -x /sbin/restorecon ] && /sbin/restorecon -R /dev # /dev/null must be created before udevd is started /lib/udev/create_static_nodes || true log_daemon_msg "Starting the hotplug events dispatcher" "udevd" if udevd --daemon; then log_end_msg $? else log_end_msg $? fi mkdir -p /dev/.udev/rules.d/ create_dev_root_rule /dev/.udev/ log_action_begin_msg "Synthesizing the initial hotplug events" if udevadm trigger --action=add; then log_action_end_msg $? else log_action_end_msg $? fi create_dev_makedev # wait for the 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 the hotplug events dispatcher" "udevd" if start-stop-daemon --stop --name udevd --quiet --oknodo --retry 5; then log_end_msg $? else log_end_msg $? fi ;; restart) log_daemon_msg "Stopping the hotplug events dispatcher" "udevd" if start-stop-daemon --stop --name udevd --quiet --oknodo --retry 5; then log_end_msg $? else log_end_msg $? || true fi log_daemon_msg "Starting the hotplug events dispatcher" "udevd" if udevd --daemon; then log_end_msg $? else log_end_msg $? fi ;; reload|force-reload) udevadm control --reload-rules ;; *) echo "Usage: /etc/init.d/udev {start|stop|restart|reload|force-reload}" exit 1 ;; esac exit 0 rc000066600000020673150770332110005106 0ustar00#! /bin/sh # # rc # # Starts/stops services on runlevel changes. # # Optimization: A start script is not run when the service was already # configured to run in the previous runlevel. A stop script is not run # when the the service was already configured not to run in the previous # runlevel. # # Authors: # Miquel van Smoorenburg # Bruce Perens PATH=/sbin:/usr/sbin:/bin:/usr/bin export PATH # Un-comment the following for interactive debugging. Do not un-comment # this for debugging a real boot process as no scripts will be executed. # debug=echo # Specify method used to enable concurrent init.d scripts. # Valid options are 'none' and 'makefile'. Obsolete options # used earlier are 'shell' and 'startpar'. The obsolete options # are aliases for 'makefile' since 2010-05-14. The default since # the same date is 'makefile', as the init.d scripts in Debian now # include dependency information and are ordered using this # information. See insserv for information on dependency based # boot sequencing. CONCURRENCY=makefile # Make sure the name survive changing the argument list scriptname="$0" umask 022 on_exit() { echo "error: '$scriptname' exited outside the expected code flow." } trap on_exit EXIT # Enable emergency handler # Ignore CTRL-C only in this shell, so we can interrupt subprocesses. trap ":" INT QUIT TSTP # Set onlcr to avoid staircase effect. stty onlcr 0>&1 # Functions for splash progress bars if [ -e /lib/init/splash-functions-base ] ; then . /lib/init/splash-functions-base else # Quiet down script if old initscripts version without /lib/init/splash-functions-base is used. splash_progress() { return 1; } splash_stop() { return 1; } fi # Now find out what the current and what the previous runlevel are. runlevel=$RUNLEVEL # Get first argument. Set new runlevel to this argument. [ "$1" != "" ] && runlevel=$1 if [ "$runlevel" = "" ] then echo "Usage: $scriptname " >&2 exit 1 fi previous=$PREVLEVEL [ "$previous" = "" ] && previous=N export runlevel previous if [ -f /etc/default/rcS ] ; then . /etc/default/rcS fi export VERBOSE if [ -f /lib/lsb/init-functions ] ; then . /lib/lsb/init-functions else log_action_msg() { echo $@; } log_failure_msg() { echo $@; } log_warning_msg() { echo $@; } fi # # Stub to do progress bar ticks (for splash programs) on startup # startup_progress() { # Avoid divide by zero if anyone moved xdm/kdm/gdm first in a runlevel. if [ 0 -eq "$num_steps" ] ; then return; fi step=$(($step + $step_change)) progress=$(($step * $progress_size / $num_steps + $first_step)) $debug splash_progress "$progress" || true } # # Check if we are able to use make like booting. It require the # insserv package to be enabled. Boot concurrency also requires # startpar to be installed. # if [ "none" != "$CONCURRENCY" ] ; then test -s /etc/init.d/.depend.boot || CONCURRENCY="none" test -s /etc/init.d/.depend.start || CONCURRENCY="none" test -s /etc/init.d/.depend.stop || CONCURRENCY="none" if test -e /etc/init.d/.legacy-bootordering ; then CONCURRENCY="none" fi startpar -v > /dev/null 2>&1 || CONCURRENCY="none" fi # # Start script or program. # case "$CONCURRENCY" in makefile|startpar|shell) # startpar and shell are obsolete CONCURRENCY=makefile log_action_msg "Using makefile-style concurrent boot in runlevel $runlevel" # The splash API is not handled with this CONCURRENCY mode. # It need to be implented in startpar. Until that is done # stop the splash screen before starting services, to avoid # usplash and X to confuse each other during boot. startup() { if [ start = "$1" ] || [ boot = "$1" ] then $debug splash_stop || true fi eval "$(startpar -p 4 -t 20 -T 3 -M $1 -P $previous -R $runlevel)" if [ -n "$failed_service" ] then log_failure_msg "startpar: service(s) returned failure: $failed_service" fi if [ -n "$skipped_service" ] then log_warning_msg "startpar: service(s) skipped: $skipped_service" fi unset failed_service skipped_service } ;; none|*) startup() { action=$1 shift scripts="$@" for script in $scripts ; do $debug "$script" $action startup_progress done } ;; esac # Check if the splash screen should be stopped before the given # script. is_splash_stop_scripts() { scriptname=$1 case "$scriptname" in # killprocs is used in runlevel 1 gdm|xdm|kdm|ltsp-client|ltsp-client-core|reboot|halt|killprocs) return 0 ;; esac return 1 } # Is there an rc directory for this new runlevel? if [ -d /etc/rc$runlevel.d ] then # Find out where in the progress bar the initramfs got to. PROGRESS_STATE=0 if [ -f /dev/.initramfs/progress_state ]; then . /dev/.initramfs/progress_state fi # Split the remaining portion of the progress bar into thirds progress_size=$(((100 - $PROGRESS_STATE) / 3)) case "$runlevel" in 0|6) ACTION=stop # Count down from 0 to -100 and use the entire bar first_step=0 progress_size=100 step_change=-1 ;; S) ACTION=start # Begin where the initramfs left off and use 2/3 # of the remaining space first_step=$PROGRESS_STATE progress_size=$(($progress_size * 2)) step_change=1 ;; *) ACTION=start # Begin where rcS left off and use the final 1/3 of # the space (by leaving progress_size unchanged) first_step=$(($progress_size * 2 + $PROGRESS_STATE)) step_change=1 ;; esac # Count the number of scripts we need to run # (for progress bars) num_steps=0 for s in /etc/rc$runlevel.d/[SK]*; do if is_splash_stop_scripts "${s##/etc/rc$runlevel.d/S??}" ; then break fi num_steps=$(($num_steps + 1)) done step=0 # First, run the KILL scripts. if [ makefile = "$CONCURRENCY" ] then if [ "$ACTION" = "start" ] && [ "$previous" != N ] then startup stop fi elif [ "$previous" != N ] then # Run all scripts with the same level in parallel CURLEVEL="" for s in /etc/rc$runlevel.d/K* do # Extract order value from symlink level=${s#/etc/rc$runlevel.d/K} level=${level%%[a-zA-Z]*} if [ "$level" = "$CURLEVEL" ] then continue fi CURLEVEL=$level SCRIPTS="" for i in /etc/rc$runlevel.d/K$level* do # Check if the script is there. [ ! -f $i ] && continue # # Find stop script in previous runlevel but # no start script there. # suffix=${i#/etc/rc$runlevel.d/K[0-9][0-9]} previous_stop=/etc/rc$previous.d/K[0-9][0-9]$suffix previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix # # If there is a stop script in the previous level # and _no_ start script there, we don't # have to re-stop the service. # [ -f $previous_stop ] && [ ! -f $previous_start ] && continue # Stop the service. SCRIPTS="$SCRIPTS $i" if is_splash_stop_scripts "$suffix" ; then $debug splash_stop || true fi done startup stop $SCRIPTS done fi if [ makefile = "$CONCURRENCY" ] then if [ S = "$runlevel" ] then startup boot else startup $ACTION fi else # Now run the START scripts for this runlevel. # Run all scripts with the same level in parallel CURLEVEL="" for s in /etc/rc$runlevel.d/S* do # Extract order value from symlink level=${s#/etc/rc$runlevel.d/S} level=${level%%[a-zA-Z]*} if [ "$level" = "$CURLEVEL" ] then continue fi CURLEVEL=$level SCRIPTS="" for i in /etc/rc$runlevel.d/S$level* do [ ! -f $i ] && continue suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9]} if [ "$previous" != N ] then # # Find start script in previous runlevel and # stop script in this runlevel. # stop=/etc/rc$runlevel.d/K[0-9][0-9]$suffix previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix # # If there is a start script in the previous level # and _no_ stop script in this level, we don't # have to re-start the service. # if [ start = "$ACTION" ] ; then [ -f $previous_start ] && [ ! -f $stop ] && continue else # Workaround for the special # handling of runlevels 0 and 6. previous_stop=/etc/rc$previous.d/K[0-9][0-9]$suffix # # If there is a stop script in the previous level # and _no_ start script there, we don't # have to re-stop the service. # [ -f $previous_stop ] && [ ! -f $previous_start ] && continue fi fi SCRIPTS="$SCRIPTS $i" if is_splash_stop_scripts "$suffix" ; then $debug splash_stop || true fi done startup $ACTION $SCRIPTS done fi fi trap - EXIT # Disable emergency handler exit 0 ssh000066600000007170150770332110005274 0ustar00#! /bin/sh ### BEGIN INIT INFO # Provides: 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 fi if ! run_by_init; then log_action_msg "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)" 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!" fi exit 1 fi } check_privsep_dir() { # Create the PrivSep empty dir if necessary if [ ! -d /var/run/sshd ]; then mkdir /var/run/sshd chmod 0755 /var/run/sshd fi } check_config() { if [ ! -e /etc/ssh/sshd_not_to_be_run ]; then /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" if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then log_end_msg 0 else log_end_msg 1 fi ;; stop) log_daemon_msg "Stopping OpenBSD Secure Shell server" "sshd" if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid; then log_end_msg 0 else log_end_msg 1 fi ;; reload|force-reload) check_for_no_start check_config log_daemon_msg "Reloading OpenBSD Secure Shell server's configuration" "sshd" if start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd; then log_end_msg 0 else log_end_msg 1 fi ;; restart) check_privsep_dir check_config log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid check_for_no_start log_end_msg check_dev_null log_end_msg if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then log_end_msg 0 else log_end_msg 1 fi ;; try-restart) check_privsep_dir check_config log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" set +e start-stop-daemon --stop --quiet --retry 30 --pidfile /var/run/sshd.pid RET="$?" set -e case $RET in 0) # old daemon stopped check_for_no_start log_end_msg check_dev_null log_end_msg if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then log_end_msg 0 else log_end_msg 1 fi ;; 1) # daemon not running log_progress_msg "(not running)" log_end_msg 0 ;; *) # failed to stop log_progress_msg "(failed to stop)" log_end_msg 1 ;; esac ;; status) status_of_proc -p /var/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}" exit 1 esac exit 0