From 10d3bfa1a32611c382d0bc7044ebd219f20e26c4 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 4 Mar 2009 18:41:39 +0100 Subject: Start/Stop/...: Don't call sudo unneccessarily --- etc/function | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/etc/function b/etc/function index 3b6e122..783d79b 100644 --- a/etc/function +++ b/etc/function @@ -12,7 +12,14 @@ unset funcfile function Start Stop Restart Reload { typeset script + function __sudo { + if ((EUID)) { + sudo $* + } else { + $* + } + } for script in $*; { - sudo /etc/init.d/$script ${0:l} + __sudo /etc/init.d/$script ${0:l} } } -- cgit v1.2.3