Marcel Runte wrote:
> Colin wrote:
>> I've noticed that several (read: all) of my initscripts which use 
>> killall to end processes like syslogd, klogd, and httpd consistently 
>> fail, saying "no process killed" strangely. Sure enough, if I try it at 
>> the command line, it doesn't work.
>>
>> I can obviously use kill -9 to kill things, but then I need the pid in 
>> order to include it in an initscript. Busybox doesn't have a command 
>> line switch to write a pid when something is launched.
>>
>> How can I kill syslogd and other processes effectively without needing a 
>> pidfile?
> 
> Not quite sure:
> By grepping the processlist for the process name and isolating the pid? Or 
> isn't ps working without proc in busybox?

pidof and killall can't get the pid of them 'cause they can't tell that 
they are actually busybox processes.

Here's the little bash script I wrote to solve this:

get_pid{
        ps | awk /$1/ | awk '{print $1}'
}

Usage: get_pid <process to be get pid of>
_______________________________________________
Clfs-support mailing list
Clfs-support@lists.cross-lfs.org
http://lists.cross-lfs.org/cgi-bin/mailman/listinfo/clfs-support

Reply via email to