From d52676d1ea51bcfc947970085184fe4d18638ccd Mon Sep 17 00:00:00 2001 From: Alberto Bursi Date: Mon, 28 Nov 2016 12:48:59 +0100 Subject: [PATCH] base-files: add a wrapper for init scripts in profile "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 --- package/base-files/files/etc/profile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile index 0118e25ff62..bb69ffbd3eb 100644 --- a/package/base-files/files/etc/profile +++ b/package/base-files/files/etc/profile @@ -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/$@ +} -- 2.30.2