<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 3, 2020 at 6:42 AM Stan Grishin <<a href="mailto:stangri@melmac.net">stangri@melmac.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Implement service list-enabled and service list-disabled to provide an easy way<br>
for users to list enabled/disabled services from CLI.<br>
<br>
Signed-off-by: Stan Grishin <<a href="mailto:stangri@melmac.net" target="_blank">stangri@melmac.net</a>><br>
---<br>
package/base-files/files/etc/profile | 21 +++++++++++++++++++++<br>
1 file changed, 21 insertions(+)<br>
<br>
diff --git a/package/base-files/files/etc/profile<br>
b/package/base-files/files/etc/profile<br>
index 0beff1608f..e8350cfd6a 100644<br>
--- a/package/base-files/files/etc/profile<br>
+++ b/package/base-files/files/etc/profile<br>
@@ -38,3 +38,24 @@ in order to prevent unauthorized SSH logins.<br>
--------------------------------------------------<br>
EOF<br>
fi<br>
+<br>
+service() {<br>
+ if [ "$1" = "list-enabled" ]; then<br>
+ for F in /etc/init.d/* ; do<br>
+ $F enabled && echo "$F enabled"<br>
+ done;<br>
+ elif [ "$1" = "list-disabled" ]; then<br>
+ for F in /etc/init.d/* ; do<br>
+ $F enabled || echo "$F disabled"<br>
+ done;<br>
+ elif [ -f "/etc/init.d/$1" ]; then<br>
+ /etc/init.d/$@<br>
+ else<br>
+ echo "Usage: service<br>
list-disabled|list-enabled|<service> [command]"<br>
+ if [ -n "$1" ]; then<br>
+ echo "service "'"'"$1"'"'" not found, the<br>
following services are available:"<br>
+ ls "/etc/init.d"<br>
+ fi<br>
+ return 1<br>
+ fi<br>
+}<br>
-- <br>
2.25.1<br>
<br></blockquote><div><br></div><div>Could you provide examples of how this would be used?</div><div><br></div><div>What about "list-start" and "list-stop" as well?<br></div></div></div>