fizord.ru - статьи - 422
[главная] | [каталоги]

0
создан: 2023-12-27 15:31:28
пользователь: cloud раздел: linux
[62]
debian/linux on - off script
отработка скрипта при включении и отключении сервера

1. nano /etc/init.d/on-off-script

#! /bin/sh

### BEGIN INIT INFO
# Provides:      on-off-message
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start/stop the on-off-message web server
# Description: start/stop on-off-message using start-stop-daemon
### END INIT INFO

case "$1" in
     start)
          /bin/bash $HOME/telegram.sh "fizord.ru server start"

     ;;
     stop)
          /bin/bash $HOME/telegram.sh "fizord.ru server off/reboot"
     ;;
     *)
          #do nothing
          exit 1
     ;;
esac



2. chmod +x /etc/init.d/on-off-script

3. update-rc.d on-off-script start . stop .

увидим ошибки, но ничего страшного, главное чтобы появились в папках
/etc/rc0.d и /etc/rc6.d
ссылки: K01on-off-script


more info:
http://www.it-simple.ru/?p=7561
https://tuksik.ru/auto-start-and-shutdown/

fizord.ru © 2024