openwrt service not Found 找不到 service命令

The service command on OpenWrt is a convenience wrapper around the usual init script machinery, it is defined as shell alias in /etc/profile. Maybe you customized your profile in the past without ever rebasing it.

Ref: https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/base-files/files/etc/profile#l48

service 命令是 被在 /etc/profle包裹取來的 的alias
其實執行的還是 /etc/init.d/ 中的腳本文件

service() {
          [ -f "/etc/init.d/$1" ] || {
                   echo "service "'"'"$1"'"'" not found, the following services are available:"
                   ls "/etc/init.d"
                   return 1
				}
			/etc/init.d/$@
}

在 profile添加service()即可

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章