Cron idiosyncrasy

Joel Hammer Joel
Mon May 17 11:50:57 PDT 2004


Opera, when run on a remote X client, often hangs this thang called
motifwrapper, which then consumes 99% of the CPU. This annoys all three
users on this box. I think it has to do with flash, and it was supposed
to have been fixed but it ain't in my hands so anyway:
Running top | grep operamotifwrap is a great way to find these processes and
kill them. (Only high consumption processes get listed with top, in my
experience.)
This script runs fine when invoked from the command line:
#!/bin/bash
for i in `/usr/bin/top -n1 | grep operamotifwrap | sed "s/ .*//"`
do
kill -9 $i
done

However, there is a problem using top with cron, so I thought I would
mention it.  When this script is called with cron, this error appears:

     tcgetattr() (undefined or something)

This is fixed by including the -b flag, as suggested in the man page for
top.

Like so:

  for i in `/usr/bin/top -n1 -b | grep operamotifwrap | sed "s/ .*//"`

Happy scripting.

Joel





More information about the Linux-users mailing list