aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xrc.d/init.d/functions13
1 files changed, 8 insertions, 5 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions
index 9fadf536..f40ace44 100755
--- a/rc.d/init.d/functions
+++ b/rc.d/init.d/functions
@@ -15,10 +15,13 @@ export PATH="/sbin:/usr/sbin:/bin:/usr/bin"
# A function to start a program.
daemon() {
# Test syntax.
- if [ $# = 0 ]; then
- echo "Usage: daemon {program}"
- return 1
- fi
+ case $1 in
+ '') echo '$0: Usage: daemon [+/-nicelevel] {program}'
+ return 1;;
+ -*|+*) nicelevel=$1
+ shift;;
+ *) nicelevel=0;;
+ esac
# Save basename.
base=`basename $1`
@@ -34,7 +37,7 @@ daemon() {
ulimit -c 0
# And start it up.
- $*
+ nice -n $nicelevel "$@"
}
# A function to stop a program.