воскресенье, 20 марта 2016 г.

выключение и ребут Debian.

  Удалить кеш пакетов и отключить промонтированные сетевые ресуры при выключении ПК:

sudo nano /etc/rc0.d/K11halt

#! /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"
sudo rm /var/cache/apt/archives/*.deb
/sh/umount-nfs.sh && halt -d -f $netdown $poweroff $hddown
}

case "$1" in
  start|status)
# 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


:


  Удалить кеш пакетов и отключить промонтированные сетевые ресуры при перезагрузке ПК:
sudo nano /etc/rc6.d/K11reboot

#! /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"
sudo rm /var/cache/apt/archives/*.deb
/sh/umount-nfs.sh && 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
;;
  status)
exit 0
;;
  *)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac


P.S. цветом отмечено, что было добавлено в оригинальный файл

Комментариев нет:

Отправить комментарий

h265.sh

#!/bin/bash file="../mp4" if [ -d $file ]; then         echo "  Директория существует :-) "         for i in *.mp4; do f...