DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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
#!/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
#! /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
:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.