Конечно, я на них наступил. На домашней машинке, работающей по совместительству роутером в провайдерские интернеты, в /etc/rc.local было несколько команд. В один прекрасный день, после какого-то апгрейда, они перестали работать. Причём запускаешь вручную после загрузки системы — всё работает.
При внимательном разглядывании после включения всей отладочной информации обнаружилось, что сам по себе скрипт при загрузке системы запускается, но выполняется из него ровно одна команда. Первая: rmmod usbhid. Неудачно, потому что на этот момент модуль usbhid ещё не загружен. А остальные выполняться перестали совсем.
Вопрос для сисадминов нумер раз: угадайте, почему. Вопрос нумер два: какого хрена?
Полные тексты /etc/init.d/rc.local и /etc/rc.local под катом.
/etc/init.d/rc.local:
#! /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
/etc/rc.local:
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. /sbin/rmmod usbhid /sbin/modprobe hid-aureal /sbin/modprobe usbhid /usr/local/sbin/masq.sh exit 0
Оригинал этой записи. Комментировать можно тут или там.
no subject
no subject
no subject
no subject
Обычно его вставляют для параноидальности, что бы не порушить последовательность команд. Но в данном случае я думаю это глупость, и надо файлить в багзилу.
no subject
no subject
no subject
no subject
no subject
А, проглядел
-e errexit Exit immediately if any untested command fails in non-interactive mode. The exit status of a command is considered to be explic- itly tested if the command is part of the list used to control an if, elif, while, or until; if the command is the left hand oper- and of an ``&&'' or ``||'' operator; or if the command is a pipe- line preceded by the ! operator. If a shell function is executed and its exit status is explicitly tested, all commands of the function are considered to be tested as well.Мда.
no subject
Может быть, расчет был на то, что сдедующие команды в rc.local расчитывают на успех предыдущих
no subject
из-за этого ?
для вash это вроде означает умереть сразу после первого non-zero exit code.
no subject
no subject
no subject
/lib/lsb/init-functions ?
no subject
no subject
no subject
no subject
no subject
no subject
no subject
Re: А, проглядел
no subject
да, интересно таки - зачем?
no subject