base-files: add a wrapper for init scripts in profile
authorAlberto Bursi <alberto.bursi@outlook.it>
Mon, 28 Nov 2016 11:48:59 +0000 (12:48 +0100)
committerJohn Crispin <john@phrozen.org>
Tue, 29 Nov 2016 20:12:08 +0000 (21:12 +0100)
"service" is a simple wrapper that will allow to call init.d scripts

current method:     #  /etc/init.d/network reload
with the wrapper:   #  service network reload

If the wrapper is called without arguments or with a wrong init script name, it will print an error and list the content of /etc/init.d/ folder

Signed-off-by: Alberto Bursi <alberto.bursi@outlook.it>
package/base-files/files/etc/profile

index 0118e25..bb69ffb 100644 (file)
@@ -41,3 +41,12 @@ in order to prevent unauthorized SSH logins.
 --------------------------------------------------
 EOF
 fi
+
+service() {
+       [ -f "/etc/init.d/$1" ] || {
+               echo -n "$1 does not exist. the following services are available :"
+               ls "/etc/init.d"
+               return 1
+       }
+       /etc/init.d/$@
+}