Скрипты автостарта демонов для Debian
Материал из BiTel WiKi
Версия от 08:21, 7 сентября 2011; FessAectan (Обсуждение | вклад)
В моем случае все ниже изложенно справедливо для
# uname -srm Linux 2.6.32-5-amd64 x86_64 # cat /etc/debian_version 6.0.2 root@bgbilling:~# service bgbilling status BGBillingServer v 5.0 build 778 from 22.10.2010 11:12:25 root@bgbilling:~# service bgipn status Traffic collector for IPN v 5.0 build 228 from 09.12.2009 13:07:53 root@bgbilling:~# service bgradius status version 5.0 build 249 from 17.12.2009 16:51:07
В /etc/init.d/ находятся
# ls -l /etc/init.d/bg* | awk '{print $9}' /etc/init.d/bgbilling /etc/init.d/bgdataloader /etc/init.d/bgipn /etc/init.d/bgradius /etc/init.d/bgscheduler
Содержание скриптов следующие
root@bgbilling:~# cat /etc/init.d/bgbilling #!/bin/bash #/etc/init.d/bgbilling ### BEGIN INIT INFO # Provides: bgbilling # Required-Start: mysql # Required-Stop: mysql # Default-Start: 2 # Default-Stop: 0 6 # Description: Start BGBilling ### END INIT INFO case "$1" in start) /usr/local/BGBillingServer/server_start.sh ;; stop) /usr/local/BGBillingServer/server_stop.sh ;; restart) /usr/local/BGBillingServer/server_start.sh /usr/local/BGBillingServer/server_stop.sh ;; status) /usr/local/BGBillingServer/server.sh status ;; *) echo "Usage: $0 start | stop | restart | status" >&2 exit 1 ;; esac exit 0 root@bgbilling:~# cat /etc/init.d/bgradius #!/bin/bash #/etc/init.d/bgradius ### BEGIN INIT INFO # Provides: bgradius # Required-Start: bgbilling # Required-Stop: bgbilling # Default-Start: 2 # Default-Stop: 0 6 # Description: Start bgradius ### END INIT INFO case "$1" in start) /usr/local/BGRadiusDialup/radius_start.sh ;; stop) /usr/local/BGRadiusDialup/radius_stop.sh ;; restart) /usr/local/BGRadiusDialup/radius_stop.sh /usr/local/BGRadiusDialup/radius_start.sh ;; status) /usr/local/BGRadiusDialup/radius_status.sh ;; *) echo "Usage: $0 start | stop | restart | status" >&2 exit 1 ;; esac exit 0 root@bgbilling:~# cat /etc/init.d/bgipn #!/bin/bash #/etc/init.d/bgipn ### BEGIN INIT INFO # Provides: bgipn # Required-Start: bgbilling # Required-Stop: bgbilling # Default-Start: 2 # Default-Stop: 0 6 # Description: Start bgipn ### END INIT INFO case "$1" in start) /usr/local/BGIPNetflowCollector/netflow_start.sh ;; stop) /usr/local/BGIPNetflowCollector/netflow_stop.sh ;; restart) /usr/local/BGIPNetflowCollector/netflow_stop.sh /usr/local/BGIPNetflowCollector/netflow_start.sh ;; status) /usr/local/BGIPNetflowCollector/netflow_status.sh ;; *) echo "Usage: $0 start | stop | restart | status" >&2 exit 1 ;; esac exit 0 root@bgbilling:~# cat /etc/init.d/bgscheduler #!/bin/sh #/etc/init.d/bgscheduler ### BEGIN INIT INFO # Provides: bgscheduler # Required-Start: bgbilling # Required-Stop: bgbilling # Default-Start: 2 # Default-Stop: 0 6 # Description: Start BGBscheduler ### END INIT INFO case "$1" in start) /usr/local/BGBillingServer/scheduler_start.sh ;; stop) /usr/local/BGBillingServer/scheduler_stop.sh ;; restart) /usr/local/BGBillingServer/scheduler_reload.sh ;; status) /usr/local/BGBillingServer/scheduler_status.sh ;; *) echo "Usage: $0 start | stop | restart | status" >&2 exit 1 ;; esac exit 0 root@bgbilling:~# cat /etc/init.d/bgdataloader #!/bin/sh #/etc/init.d/bgdataloader ### BEGIN INIT INFO # Provides: bgdataloader # Required-Start: bgbilling # Required-Stop: bgbilling # Default-Start: 2 # Default-Stop: 0 6 # Description: Start bgdataloader ### END INIT INFO case "$1" in start) /usr/local/BGBillingServer/data_loader_start.sh ;; stop) /usr/local/BGBillingServer/data_loader_stop.sh ;; restart) /usr/local/BGBillingServer/data_loader_stop.sh /usr/local/BGBillingServer/data_loader_start.sh ;; status) /usr/local/BGBillingServer/data_loader_status.sh ;; *) echo "Usage: $0 start | stop | restart | status" >&2 exit 1 ;; esac exit 0
После достаточно ввести команды
# insserv bgbilling # insserv bgdataloader # insserv bgipn # insserv bgradius # insserv bgscheduler
- возможно достаточно написать все одной строкой, я не пробовал =)
# insserv bgbilling bgdataloader bgscheduler bgipn bgradius
Теперь отправляемся в ребут, по удачному завершению оного проверяем запустились ли наши демоны.