[source] base-files: add a wrapper for init scripts in profile
LEDE Commits
lede-commits at lists.infradead.org
Wed Nov 30 00:00:58 PST 2016
blogic pushed a commit to source.git, branch master:
https://git.lede-project.org/d52676d1ea51bcfc947970085184fe4d18638ccd
commit d52676d1ea51bcfc947970085184fe4d18638ccd
Author: Alberto Bursi <alberto.bursi at outlook.it>
AuthorDate: Mon Nov 28 12:48:59 2016 +0100
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 <alberto.bursi at outlook.it>
---
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 0118e25..bb69ffb 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/$@
+}
More information about the lede-commits
mailing list