This line from vblade-10-r1 will fail: ps -Ao pid,args |egrep "^[[:digit:]]+ /usr/sbin/vblade ${@}" | awk '{print $1}' | xargs kill ... when vblade's pid is, for example, 4 digits and you have other programs running with pids of 5 or more digits. Take a look at this: zeddmore init.d # ps -Ao pid,args . . . 5496 tlsmgr -l -t unix -u 7059 pickup -l -t fifo -u 7194 sshd: nbensa [priv] 7199 sshd: nbensa@pts/0 7200 -bash 7205 su 7206 bash 11593 /bin/sh /usr/sbin/vbladed 0 0 eth0 /dev/hda 11596 /usr/sbin/vblade 0 0 eth0 /dev/hda 11597 /usr/bin/logger -t vblade.vblade0 11641 ps -Ao pid,args zeddmore init.d # ps -Ao pid,args | egrep "^[[:digit:]]+ " 11593 /bin/sh /usr/sbin/vbladed 0 0 eth0 /dev/hda 11596 /usr/sbin/vblade 0 0 eth0 /dev/hda 11597 /usr/bin/logger -t vblade.vblade0 11644 ps -Ao pid,args 11645 egrep ^[[:digit:]]+ You need to remove the "^" from the RE to make it work.
fixed. Removing ^ was not the best option, as it could then catch some other arguments. Adding [[:space:]]* between the ^ and [[:digit:]]+ is the best solution.