diff options
author | Alberto Bursi <alberto.bursi@outlook.it> | 2016-11-28 12:48:59 +0100 |
---|---|---|
committer | John Crispin <john@phrozen.org> | 2016-11-29 21:12:08 +0100 |
commit | d52676d1ea51bcfc947970085184fe4d18638ccd (patch) | |
tree | ae7ea838496576a2c814dd799c38f470942ee1dd /package/base-files/files/etc/profile | |
parent | 102cb4742c14f78bf86b7d77c568c205f0d99d85 (diff) | |
download | upstream-d52676d1ea51bcfc947970085184fe4d18638ccd.tar.gz upstream-d52676d1ea51bcfc947970085184fe4d18638ccd.tar.bz2 upstream-d52676d1ea51bcfc947970085184fe4d18638ccd.zip |
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@outlook.it>
Diffstat (limited to 'package/base-files/files/etc/profile')
-rw-r--r-- | package/base-files/files/etc/profile | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile index 0118e25ff6..bb69ffbd3e 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/$@ +} |