LinuxForum.Fans
Тема

halt, shutdown -hH now

Автор: zenon 5 сообщений 4661 просмотров
#349586

На некоторых машинах сабж отрабатывает правильно, а на некоторых выключает питание, что не должен делать, выключать питание должен shutdown -hP now.
Пока на машинах с ups выхожу из положения своим скриптом с init 1.
ы:

text
# ls -la /sbin/{reboot,halt,shutdown}
-rwxr-xr-x 1 root root 19K 13-08-12 125000 /sbin/halt
lrwxrwxrwx 1 root root   4 13-08-12 125000 /sbin/reboot -> halt
-rwxr-xr-x 1 root root 23K 13-08-12 125000 /sbin/shutdown
#349607

Не, ну это просто засада какая-то, дурдом.
shutdown -hH now, halt - по умолчанию вызывают init 0

text
# grep halt /etc/inittab
l0s:0:wait:/sbin/halt -dhp

man halt нам сообщает:

text
OPTIONS
       -n     Don't sync before reboot or halt. Note that the kernel and storage drivers may still sync.
       -w     Don't actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file).
       -d     Don't write the wtmp record. The -n flag implies -d.
       -f     Force halt or reboot, don't call shutdown(8).
       -i     Shut down all network interfaces just before halt or reboot.
       -h     Put all hard drives on the system in stand-by mode just before halt or power-off.
       -p     When halting the system, switch off the power. This is the default when halt is called as poweroff.
       -k     Try to reboot using kexec, if kernel supports it.

Меняем в inittab halt -dhp на halt -dhi и всё становится более правильным.

#349706

... всё равно где-то что-то упускаю, по команде из консоли shutdown -H/-P now или /sbin/halt -dp равно как и /sbin/halt -dh выполняется ровно то, что написано в inittab, те реакция на ключи у команды halt есть только при запуске init`a, а именно если в inittab стоит halt -dp, то питание _всегда_выключится....
А должно то быть вот так.
У всех правильно работают?
shut down now and halt but not poweroff:

text
shutdown -hH now

shut down and poweroff now:

text
shutdown -hP now

reboot now:

text
shutdown -r now

single user mode:

text
shutdown now
#349747

Я такими пользуюсь:
выключение -

text
# shutdown -h now

ребут -

text
# shutdown -r now
#349749
-=Serj=- написал:
Я такими пользуюсь:
выключение -
text
# shutdown -h now

ребут -

text
# shutdown -r now

shutdown -h now - должна работать как poweroff.
shutdown -hH now - должна остановить систему, ! но не выключить питание, то есть на дисплее должна красоваться надпись "system halted", а блок питания продолжать работать.
man shutdown:

text
HALT OR POWEROFF
       The  -H  option just sets the init environment variable INIT_HALT to HALT, and the -P option just sets that variable to POWEROFF. The shutdown script that calls halt(8) as the
       last thing in the shutdown sequence should check these environment variables and call halt(8) with the right options for these options to actually have any effect.

ы. Проверил на Debian/Ubuntu, работает как и положено, на стабильной Gentoo не могу сейчас посмотреть, но на Gentoo ~x86_64 - в двух местах - криво.

Войдите или зарегистрируйтесь, чтобы ответить.