diff options
author | Michael Lauer <mickey@vanille-media.de> | 2007-08-20 12:03:16 +0000 |
---|---|---|
committer | Michael Lauer <mickey@vanille-media.de> | 2007-08-20 12:03:16 +0000 |
commit | 8276d6ef3f035028322f1063c98b9717cd80db09 (patch) | |
tree | 70c1571a0dbb01a0022452d744ee80c533d36cee /packages/initscripts/initscripts-1.0/functions | |
parent | 71e917c19c83c7042eca136c30bb97eb5ac3f6b0 (diff) |
initscripts: add a functions script that is supposed to be sourced from individual init scripts providing some useful functions.
added cpuinfo_id() and killproc() for a start
Diffstat (limited to 'packages/initscripts/initscripts-1.0/functions')
-rw-r--r-- | packages/initscripts/initscripts-1.0/functions | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/initscripts/initscripts-1.0/functions b/packages/initscripts/initscripts-1.0/functions new file mode 100644 index 0000000000..358fc6edb3 --- /dev/null +++ b/packages/initscripts/initscripts-1.0/functions @@ -0,0 +1,17 @@ +# -*-Shell-script-*- +# +# functions This file contains functions to be used by most or all +# shell scripts in the /etc/init.d directory. +# + +cpuinfo_id() { # return the Hardware module ID + awk 'BEGIN { FS=": " } /Hardware/ { print $2 } ' </proc/cpuinfo +} + +killproc() { # kill the named process(es) + pid=`/bin/ps -e x | + /bin/grep $1 | + /bin/grep -v grep | + /bin/sed -e 's/^ *//' -e 's/ .*//'` + [ "$pid" != "" ] && kill $pid +} |