2 # Copyright (C) 2006-2012 OpenWrt.org
4 . $IPKG_INSTROOT/lib/functions.sh
5 . $IPKG_INSTROOT/lib/functions/service.sh
38 name="$(basename "${initscript}")"
39 rm -f "$IPKG_INSTROOT"/etc/rc.d/S??$name
40 rm -f "$IPKG_INSTROOT"/etc/rc.d/K??$name
44 name="$(basename "${initscript}")"
46 [ -n "$START" -o -n "$STOP" ] || {
47 echo "/etc/init.d/$name does not have a START or STOP value"
50 [ "$START" ] && ln -s "../init.d/$name" "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}"
51 [ "$STOP" ] && ln -s "../init.d/$name" "$IPKG_INSTROOT/etc/rc.d/K${STOP}${name##K[0-9][0-9]}"
55 name="$(basename "${initscript}")"
56 [ -x "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}" ]
65 Syntax: $initscript [command]
68 start Start the service
70 restart Restart the service
71 reload Reload configuration files (or restart if service does not implement reload)
72 enable Enable service autostart
73 disable Disable service autostart
99 [ -n "$USE_PROCD" ] && {
100 EXTRA_COMMANDS="${EXTRA_COMMANDS} running trace"
102 . $IPKG_INSTROOT/lib/functions/procd.sh
103 basescript=$(readlink "$initscript")
106 [ -n "$2" ] && method="add"
107 procd_open_service "$(basename ${basescript:-$initscript})" "$initscript"
109 procd_close_service "$method"
113 rc_procd start_service "$@"
114 if eval "type service_started" 2>/dev/null >/dev/null; then
126 procd_kill "$(basename ${basescript:-$initscript})" "$1"
130 if eval "type reload_service" 2>/dev/null >/dev/null; then
142 ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled depends ${EXTRA_COMMANDS}"
143 list_contains ALL_COMMANDS "$action" || action=help