2 # Copyright (C) 2006-2012 OpenWrt.org
4 . $IPKG_INSTROOT/lib/functions.sh
5 . $IPKG_INSTROOT/lib/functions/service.sh
39 name="$(basename "${initscript}")"
40 rm -f "$IPKG_INSTROOT"/etc/rc.d/S??$name
41 rm -f "$IPKG_INSTROOT"/etc/rc.d/K??$name
46 name="$(basename "${initscript}")"
48 ln -sf "../init.d/$name" "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}" && \
51 ln -sf "../init.d/$name" "$IPKG_INSTROOT/etc/rc.d/K${STOP}${name##K[0-9][0-9]}" && \
57 name="$(basename "${initscript}")"
58 [ -x "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}" ]
67 Syntax: $initscript [command]
70 start Start the service
72 restart Restart the service
73 reload Reload configuration files (or restart if service does not implement reload)
74 enable Enable service autostart
75 disable Disable service autostart
76 enabled Check if service is started on boot
99 local service="${1:-$(basename $initscript)}"
100 local instance="${2:-*}"
101 procd_running "$service" "$instance" "$@"
104 ${INIT_TRACE:+set -x}
108 [ -n "$USE_PROCD" ] && {
109 EXTRA_COMMANDS="${EXTRA_COMMANDS} running status trace"
111 running Check if service is running
112 status Service status
115 . $IPKG_INSTROOT/lib/functions/procd.sh
116 basescript=$(readlink "$initscript")
119 [ -n "$2" ] && method="add"
120 procd_open_service "$(basename ${basescript:-$initscript})" "$initscript"
122 procd_close_service "$method"
126 rc_procd start_service "$@"
127 if eval "type service_started" 2>/dev/null >/dev/null; then
140 procd_kill "$(basename ${basescript:-$initscript})" "$1"
141 if eval "type service_stopped" 2>/dev/null >/dev/null; then
147 if eval "type reload_service" 2>/dev/null >/dev/null; then
160 if eval "type status_service" 2>/dev/null >/dev/null; then
163 _procd_status "$(basename ${basescript:-$initscript})" "$1"
168 ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled depends ${EXTRA_COMMANDS}"
169 list_contains ALL_COMMANDS "$action" || action=help