aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/initscripts/files/functions
blob: b9dca1f96b82baec6f48185fce321dbc3893b819 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# -*-Shell-script-*-
#
# functions     This file contains functions to be used by most or all
#               shell scripts in the /etc/init.d directory.
#

machine_id() {		# return the machine ID
    id=`awk 'BEGIN { FS=": " } /Hardware/ { gsub(" ", "_", $2); print tolower($2) } ' </proc/cpuinfo`
    if [ -z "$id" ]; then
        id=`awk 'BEGIN { FS=": " } /platform/ { gsub(" ", "_", $2); print tolower($2) } ' </proc/cpuinfo`
    fi
    echo -n "$id"
}

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
}