LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 10-16-2012, 03:30 AM   #1
crowl
LQ Newbie
 
Registered: Oct 2003
Posts: 25

Rep: Reputation: 0
debian emty init scripts /etc/init.d


I have tried to make some some scripts autostart at my new debian squeeze system.

Accidentally it seems that I have clear all active init scripts, apache2, bind9, cron, all those scripts are empty

Code:
root@host:/etc/init.d# ls -la
total 212
drwxr-xr-x  2 root root  4096 Oct 16 10:02 .
drwxr-xr-x 80 root root  4096 Oct 16 00:06 ..
-rwxr-xr-x  1 root root     0 Oct 16 09:50 acpid
-rwxr-xr-x  1 root root     0 Oct 16 09:50 apache2
-rwxr-xr-x  1 root root     0 Oct 16 09:50 bind9
-rwxr-xr-x  1 root root  2444 Jan  1  2011 bootlogd
-rwxr-xr-x  1 root root     0 Oct 16 09:50 bootlogs
-rwxr-xr-x  1 root root  1381 Jan  1  2011 bootmisc.sh
-rwxr-xr-x  1 root root  3978 Jan  1  2011 checkfs.sh
-rwxr-xr-x  1 root root 10822 Jan  1  2011 checkroot.sh
-rwxr-xr-x  1 root root  1279 Jun 26  2010 console-setup
-rwxr-xr-x  1 root root     0 Oct 16 09:50 courier-authdaemon
-rwxr-xr-x  1 root root     0 Oct 16 09:50 courier-imap
-rwxr-xr-x  1 root root     0 Oct 16 09:50 courier-pop
-rwxr-xr-x  1 root root     0 Oct 16 09:50 cron
-rw-r--r--  1 root root  1921 Oct 16 10:10 .depend.boot
-rw-r--r--  1 root root   497 Oct 16 10:10 .depend.start
-rw-r--r--  1 root root   873 Oct 16 10:10 .depend.stop
-rwxr-xr-x  1 root root  1329 Jan  1  2011 halt
-rwxr-xr-x  1 root root  1423 Jan  1  2011 hostname.sh
-rwxr-xr-x  1 root root  5079 Jan 25  2011 hwclockfirst.sh
-rwxr-xr-x  1 root root  5061 Jan 25  2011 hwclock.sh
-rwxr-xr-x  1 root root  2518 Sep 15  2006 ifupdown
-rwxr-xr-x  1 root root  1047 Sep  6  2009 ifupdown-clean
-rwxr-xr-x  1 root root  7743 Oct 13  2010 kbd
-rwxr-xr-x  1 root root  1486 Jun 26  2010 keyboard-setup
-rwxr-xr-x  1 root root  1293 Jan  1  2011 killprocs
-rwxr-xr-x  1 root root  1334 Jun 28  2010 module-init-tools
-rwxr-xr-x  1 root root   620 Jan  1  2011 mountall-bootclean.sh
-rwxr-xr-x  1 root root  1668 Jan  1  2011 mountall.sh
-rwxr-xr-x  1 root root  1560 Jan  1  2011 mountdevsubfs.sh
-rwxr-xr-x  1 root root  1924 Jan  1  2011 mountkernfs.sh
-rwxr-xr-x  1 root root   628 Jan  1  2011 mountnfs-bootclean.sh
-rwxr-xr-x  1 root root  2330 Jan  1  2011 mountnfs.sh
-rwxr-xr-x  1 root root  1315 Jan  1  2011 mountoverflowtmp
-rwxr-xr-x  1 root root  3649 Jan  1  2011 mtab.sh
-rwxr-xr-x  1 root root     0 Oct 16 09:50 mysql
-rwxr-xr-x  1 root root  2451 Apr 19  2010 networking
-rwxr-xr-x  1 root root     0 Oct 16 09:50 postfix
-r-xr-xr-x  1 root root     0 Oct 16 09:50 prltoolsd
-r-xr-xr-x  1 root root     0 Oct 16 09:50 prl-x11
-rwxr-xr-x  1 root root  1298 Feb  1  2010 procps
-rwxr-xr-x  1 root root     0 Oct 16 09:50 proftpd
-rwxr-xr-x  1 root root  8635 Mar 24  2012 rc
-rwxr-xr-x  1 root root     0 Oct 16 09:50 rc.local
-rwxr-xr-x  1 root root   117 Mar 24  2012 rcS
-rw-r--r--  1 root root  2427 Mar 24  2012 README
-rwxr-xr-x  1 root root   639 Jan  1  2011 reboot
-rwxr-xr-x  1 root root     0 Oct 16 09:50 rmnologin
-rwxr-xr-x  1 root root     0 Oct 16 09:50 rsyslog
-rwxr-xr-x  1 root root  3286 Jan  1  2011 sendsigs
-rwxr-xr-x  1 root root   590 Jan  1  2011 single
-rw-r--r--  1 root root  4304 Mar 24  2012 skeleton
-rwxr-xr-x  1 root root     0 Oct 16 09:50 ssh
-rwxr-xr-x  1 root root     0 Oct 16 09:50 stop-bootlogd
-rwxr-xr-x  1 root root  1143 Jan  1  2011 stop-bootlogd-single
-rwxr-xr-x  1 root root  7578 Dec 13  2010 udev
-rwxr-xr-x  1 root root  1153 Dec 13  2010 udev-mtab
-rwxr-xr-x  1 root root  2869 Jan  1  2011 umountfs
-rwxr-xr-x  1 root root  2143 Jan  1  2011 umountnfs.sh
-rwxr-xr-x  1 root root  1456 Jan  1  2011 umountroot
-rwxr-xr-x  1 root root  1985 Jan  1  2011 urandom
-rwxr-xr-x  1 root root     0 Oct 16 09:50 vsftpd
Probably it was issued due to a wrong using of insserv, I guess - not sure. However, what is the best way to recreate the init scripts? Copy them from another machine?

I already tried "aptitude reinstall apache2" but this does not create a new file at /etc/init.d/apache2.

Last edited by crowl; 10-16-2012 at 03:34 AM.
 
Old 10-16-2012, 06:23 AM   #2
el chapulín
Member
 
Registered: Sep 2012
Posts: 75

Rep: Reputation: 19
This should get you out of trouble:
Code:
# apt-get install --reinstall initscripts acpid apache2.2-common bind9 courier-authdaemon courier-imap courier-pop cron mysql-server-5.1 postfix procps proftpd-basic rsyslog openssh-server vsftpd
As these two are not official debian init scripts, you'll have to sort those out yourself by reinstalling them from wherever you sourced them from:
Code:
-r-xr-xr-x  1 root root     0 Oct 16 09:50 prltoolsd
-r-xr-xr-x  1 root root     0 Oct 16 09:50 prl-x11

Last edited by el chapulín; 10-16-2012 at 06:25 AM.
 
Old 10-16-2012, 10:00 AM   #3
crowl
LQ Newbie
 
Registered: Oct 2003
Posts: 25

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by el chapulín View Post
This should get you out of trouble:
Code:
# apt-get install --reinstall initscripts acpid apache2.2-common bind9 courier-authdaemon courier-imap courier-pop cron mysql-server-5.1 postfix procps proftpd-basic rsyslog openssh-server vsftpd
Thanks for your assistance. Unfortunately, it does not work (just use bind9 here in order to keep the sample short, it does not work with the others, too)
Quote:
root@myhost:/etc/init.d# apt-get install --reinstall initscripts bind9
Reading package lists...
Building dependency tree...
Reading state information...
Preconfiguring packages ...
0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0 B/425 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... (Reading database ... 5%(Reading database ... 10%(Reading database ... 15%(Reading database ... 20%(Reading database ... 25%(Reading database ... 30%(Reading database ... 35%(Reading database ... 40%(Reading database ... 45%(Reading database ... 50%(Reading database ... 55%(Reading database ... 60%(Reading database ... 65%(Reading database ... 70%(Reading database ... 75%(Reading database ... 80%(Reading database ... 85%(Reading database ... 90%(Reading database ... 95%(Reading database ... 100%(Reading database ... 35792 files and directories currently installed.)
Preparing to replace initscripts 2.88dsf-13.1+squeeze1 (using .../initscripts_2.88dsf-13.1+squeeze1_amd64.deb) ...
Unpacking replacement initscripts ...
Processing triggers for man-db ...
Setting up initscripts (2.88dsf-13.1+squeeze1) ...
insserv: warning: script 'K01courier-authdaemon' missing LSB tags and overrides
insserv: warning: script 'K01courier-pop' missing LSB tags and overrides
insserv: warning: script 'K01proftpd' missing LSB tags and overrides
insserv: warning: script 'K01bind9' missing LSB tags and overrides
insserv: warning: script 'K01prltoolsd' missing LSB tags and overrides
insserv: warning: script 'K01mysql' missing LSB tags and overrides
insserv: warning: script 'K01postfix' missing LSB tags and overrides
insserv: warning: script 'K01apache2' missing LSB tags and overrides
insserv: warning: script 'K02rsyslog' missing LSB tags and overrides
insserv: warning: script 'K01prl-x11' missing LSB tags and overrides
insserv: warning: script 'K01courier-imap' missing LSB tags and overrides
insserv: warning: script 'S02bootlogs' missing LSB tags and overrides
insserv: warning: script 'K01vsftpd' missing LSB tags and overrides
insserv: warning: script 'S02stop-bootlogd' missing LSB tags and overrides
insserv: warning: script 'S02ssh' missing LSB tags and overrides
insserv: warning: script 'S02rc.local' missing LSB tags and overrides
insserv: warning: script 'S02rmnologin' missing LSB tags and overrides^
... a lot of more insserv warnings ...
(Reading database ... 35792 files and directories currently installed.)
Preparing to replace bind9 1:9.7.3.dfsg-1~squeeze7 (using .../bind9_1%3a9.7.3.dfsg-1~squeeze7_amd64.deb) ...
Unpacking replacement bind9 ...
Processing triggers for man-db ...
Setting up bind9 (1:9.7.3.dfsg-1~squeeze7) ...
insserv: warning: script 'K01courier-authdaemon' missing LSB tags and overrides
insserv: warning: script 'K01courier-pop' missing LSB tags and overrides
... a lot of more insserv warnings
Any help is much appreciated.
 
Old 10-16-2012, 10:38 AM   #4
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,674

Rep: Reputation: 122Reputation: 122
acpid:
Code:
#!/bin/sh
### BEGIN INIT INFO
# Provides:          acpid
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# X-Start-Before:    kdm gdm xdm hal
# X-Stop-After:      kdm gdm xdm hal
# Default-Start:     2 3 4 5
# Default-Stop:      
# Short-Description: Start the Advanced Configuration and Power Interface daemon
# Description:       Provide a socket for X11, hald and others to multiplex
#                    kernel ACPI events.
### END INIT INFO

set -e

ACPID="/usr/sbin/acpid"
DEFAULTS="/etc/default/acpid"

# Check for daemon presence
[ -x "$ACPID" ] || exit 0

OPTIONS=""
MODULES=""
# Include acpid defaults if available
[ -r "$DEFAULTS" ] && . "$DEFAULTS"

# Get lsb functions
. /lib/lsb/init-functions

# As the name says. If the kernel supports modules, it'll try to load
# the ones listed in "MODULES".
load_modules() {
    [ -f /proc/modules ] || return 0
    if [ "$MODULES" = "all" ]; then
        MODULES="$(sed -rn 's#^(/lib/modules/[^/]+/)?kernel/(drivers|ubuntu)/acpi/([^/]+/)*(.*)\.ko:.*#\4#p' "/lib/modules/$(uname -r)/modules.dep")"
    fi

    if [ -z "$MODULES" ]; then
        return
    fi

    log_begin_msg "Loading ACPI kernel modules..."
    # work around a bug in initramfs which leaks this env var Launchpad #291619
    # and a bug in modprobe --all --quiet which doesn't load all modules and
    # exits with non-zero exit status Debian #504088
    unset MODPROBE_OPTIONS
    modprobe --all --use-blacklist $MODULES 2>/dev/null
    log_end_msg $?
}

case "$1" in
  start)
    load_modules || true
    log_begin_msg "Starting ACPI services..."
    start-stop-daemon --start --quiet --oknodo --exec "$ACPID" -- $OPTIONS
    log_end_msg $?
    ;;
  stop)
    log_begin_msg "Stopping ACPI services..."
    start-stop-daemon --stop --quiet --oknodo --retry 2 --exec "$ACPID"
    log_end_msg $?
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  reload|force-reload) 
    log_begin_msg "Reloading ACPI services..."
    start-stop-daemon --stop --signal 1 --exec "$ACPID"
    log_end_msg $?
    ;;
  status)
    status_of_proc "$ACPID" acpid
    ;;
  *)
    log_success_msg "Usage: /etc/init.d/acpid {start|stop|restart|reload|force-reload|status}"
    exit 1
esac
bootlogs:
Code:
#!/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

:
cron:
Code:
#!/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
 
Old 10-16-2012, 10:40 AM   #5
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,674

Rep: Reputation: 122Reputation: 122
rc.local;
Code:
#! /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
rmnologin:
Code:
#! /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

:
rsyslog:
Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides:          rsyslog
# Required-Start:    $remote_fs $time
# Required-Stop:     umountnfs $time
# X-Stop-After:      sendsigs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: enhanced syslogd
# Description:       Rsyslog is an enhanced multi-threaded syslogd.
#                    It is quite compatible to stock sysklogd and can be 
#                    used as a drop-in replacement.
### END INIT INFO

#
# Author: Michael Biebl <biebl@debian.org>
#

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="enhanced syslogd"
NAME=rsyslog

RSYSLOGD=rsyslogd
RSYSLOGD_BIN=/usr/sbin/rsyslogd
RSYSLOGD_OPTIONS="-c4"
RSYSLOGD_PIDFILE=/var/run/rsyslogd.pid

SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$RSYSLOGD_BIN" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Define LSB log_* functions.
. /lib/lsb/init-functions

do_start()
{
	DAEMON="$RSYSLOGD_BIN"
	DAEMON_ARGS="$RSYSLOGD_OPTIONS"
	PIDFILE="$RSYSLOGD_PIDFILE"

	# Return
	#   0 if daemon has been started
	#   1 if daemon was already running
	#   other if daemon could not be started or a failure occured
	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS
}

do_stop()
{
	NAME="$RSYSLOGD"
	PIDFILE="$RSYSLOGD_PIDFILE"

	# Return
	#   0 if daemon has been stopped
	#   1 if daemon was already stopped
	#   other if daemon could not be stopped or a failure occurred
	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
}

#
# Tell rsyslogd to reload its configuration
#
do_reload() {
	NAME="$RSYSLOGD"
	PIDFILE="$RSYSLOGD_PIDFILE"

	start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE --name $NAME
}

create_xconsole() {
	XCONSOLE=/dev/xconsole
	if [ "$(uname -s)" = "GNU/kFreeBSD" ]; then
		XCONSOLE=/var/run/xconsole
		ln -sf $XCONSOLE /dev/xconsole
	fi
	if [ ! -e $XCONSOLE ]; then
		mknod -m 640 $XCONSOLE p
		chown root:adm $XCONSOLE
		[ -x /sbin/restorecon ] && /sbin/restorecon $XCONSOLE
	fi
}

sendsigs_omit() {
	OMITDIR=/lib/init/rw/sendsigs.omit.d
	mkdir -p $OMITDIR
	rm -f $OMITDIR/rsyslog
	ln -s $RSYSLOGD_PIDFILE $OMITDIR/rsyslog
}

case "$1" in
  start)
	log_daemon_msg "Starting $DESC" "$RSYSLOGD"
	create_xconsole
	do_start
	case "$?" in
		0) sendsigs_omit
		   log_end_msg 0 ;;
		1) log_progress_msg "already started"
		   log_end_msg 0 ;;
		*) log_end_msg 1 ;;
	esac

	;;
  stop)
	log_daemon_msg "Stopping $DESC" "$RSYSLOGD"
	do_stop
	case "$?" in
		0) log_end_msg 0 ;;
		1) log_progress_msg "already stopped"
		   log_end_msg 0 ;;
		*) log_end_msg 1 ;;
	esac

	;;
  reload|force-reload)
	log_daemon_msg "Reloading $DESC" "$RSYSLOGD"
	do_reload
	log_end_msg $?
	;;
  restart)
	$0 stop
	$0 start
	;;
  status)
	status_of_proc -p $RSYSLOGD_PIDFILE $RSYSLOGD_BIN $RSYSLOGD && exit 0 || exit $?
	;;
  *)
	echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2
	exit 3
	;;
esac

:
 
Old 10-16-2012, 10:42 AM   #6
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,674

Rep: Reputation: 122Reputation: 122
ssh:
Code:
#! /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
stop-bootlogd:
Code:
#! /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

:
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Setting flags Debian init.d scripts kamaradski1 Linux - Newbie 3 12-26-2011 02:36 PM
[SOLVED] How to monitor init scripts in /etc/init.d/ in rhel 5 me_spearhead Red Hat 2 02-09-2011 10:41 PM
Diffrence /etc/init.d and /etc/init.d/rc?.d scripts veeruhs Linux - Server 3 07-29-2010 04:42 AM
[SOLVED] init scripts, variables in INIT INFO section catkin Linux - General 1 08-18-2009 02:02 PM
Problem installing debian etch /scripts/init-premount guillermo Linux - General 2 01-19-2008 11:00 AM


All times are GMT -5. The time now is 01:00 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration