Re: kill with regex?
try
man pidof
:)
On Sun, Jan 19, 2003 at 01:37:07PM -0500, Antonio Rodriguez wrote:
> Jor-el wrote:
> >On Sun, 19 Jan 2003, Colin Watson wrote:
> >>On Sun, Jan 19, 2003 at 05:32:19PM +0100, Philipp Gruemmer wrote:
> >>>Hugh Saunders wrote:
> >>>>ps x gives a list of xine's which i would like to kill
> >>>>2) how do i get kill or bash to realise its an expression?
> > A more general solution would be :
> >
> > <produce list of pids to kill> | xargs kill
> How would you produce this list?
pidof <command>
$ ps ax | grep apache-perl
2642 ? S 0:02 /usr/sbin/apache-perl
24276 ? S 0:00 /usr/sbin/apache-perl
24601 ? S 0:00 /usr/sbin/apache-perl
25056 ? S 0:00 /usr/sbin/apache-perl
25220 ? S 0:00 /usr/sbin/apache-perl
25640 pts/0 S 0:00 -usr/bin/tcsh -c (ps ax | grep apache-perl) < /tmp/v118216/4 >&/tmp/v118216/5
25648 pts/0 S 0:00 grep apache-perl
note that with grep you either get false hits, or have to do
more complicated matches to skip the false hits...
$ pidof apache-perl
25220 25056 24601 24276 2642
easy! so you could
$ kill `pidof xine`
and be done. :)
--
I use Debian/GNU Linux version 3.0;
Linux server 2.2.17 #1 Sun Jun 25 09:24:41 EST 2000 i586 unknown
DEBIAN NEWBIE TIP #94 from Joost Kooij <joost@topaz.mdcc.cx>
:
How do you RESTORE THE DEFAULT PERMISSIONS back on the / tree?
If you have a clean host with very similar filesystem contents,
try this:
ssh root@okayhost "find / -regex '/\(mnt\|proc\|tmp\)/.*' -prune -or \
-not -type l -not -type s -printf '%04.4m %u %g %p\n' " \
| while read mode user group path
do
chown $user.$group $path
chmod $mode $path
done
Alternatively, create a huge script like this:
find / -regex '/\(mnt\|proc\|tmp\)/.*' -prune -or \
-not -type l -not -type s -printf 'chown %u.%g %p\nchmod %m %p\n' \
> fixperms.sh
And copy that to the broken machine and run "sh fixperms".
It might not fix all files, unless the two hosts are nearly
equal, but enough to let you find the missing ones to fix by
hand. Maybe /home/* will need special care.
Also see http://newbieDoc.sourceForge.net/ ...
Reply to: