source: trunk/packages/sipb-xen-base/files/lib/init/config-init.sh @ 1299

Last change on this file since 1299 was 1211, checked in by price, 16 years ago

factor out common initscript code

File size: 781 bytes
Line 
1# For a package which only configures another, "parent" package.
2#
3# Global variable PARENTPACKAGE names parent; may be array
4# for zero or many parents.
5#
6# Global variable PACKAGE names this package, for log message.
7#
8# Requires bash.
9
10. /lib/init/vars.sh
11. /lib/lsb/init-functions
12. /lib/init/gen-files.sh
13
14config_init () {
15  case "$1" in
16    start|reload|force-reload|restart)
17      log_begin_msg "Reloading config for $PACKAGE"
18      gen_files
19      log_end_msg $?
20      for p in "${PARENTPACKAGE[@]}"; do
21        /etc/init.d/"$p" "$1"
22      done
23      ;;
24    stop)
25      for p in "${PARENTPACKAGE[@]}"; do
26        /etc/init.d/"$p" "$1"
27      done
28      ;;
29    *)
30      log_success_msg "Usage: /etc/init.d/$PACKAGE {start|reload|force-reload|restart|stop}"
31      ;;
32  esac
33}
Note: See TracBrowser for help on using the repository browser.