开发者

Adding init.d service (chkconfig / autocomplete in shell)

I've made a start开发者_JS百科up script, (i.e. myserviced) and put it in /etc/init.d/

I ran

chkconfig --add myserviced

I can start/stop/restart the service just find using:

service myserviced start

etc. However, I notice that when I type "service" and then do TAB (to get a list of possible completions), I don't see myserviced in the list of possible completions (it lists all the other services). How do I add myserviced to the auto-completion list?

This is in zsh on RHEL.

Thanks


you can use the following command to add all listed scripts in /etc/init.d/ to the service command:

complete -W "$(ls /etc/init.d/)" service

-W will create word list from the ($)specified path which 'service' will use for auto-complete.


Make sure myserviced is "executable." (i.e., chmod +x /etc/init.d/myserviced)

The completion lists all executable files in /etc/init.d, while service itself may work regardless of the permission.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜