'kill' in bash script

Ron Peterson rpeterson at yellowbank.com
Thu Feb 3 10:01:46 EST 2000


Well I still haven't gotten my dumb kill script to work when called by
cron.  I explicitly specified all paths.  Yes, I installed via 'crontab
-e'.  I can run other crontab jobs, so it's not a cron permissions
problem.

Here's the error message cron emails to me:

> usage: kill [ -s signal | -p ] [ -a ] pid ...
>        kill -l [ signal ]
> 647
> Could not open X display "".

This script *does* work if I call it manually.  Here's the whole thing:

#!/bin/bash
cd /home/ybrp01/temp
/bin/ps ax | /bin/grep [b]ackfract | /bin/awk '{print $1}' |
/usr/bin/xargs -n1 kill
/usr/games/bin/backfract -delay 240 -colors 256

and my crontab:

SHELL=/bin/bash
#
0 */1 * * *	/home/ybrp01/bin/background.bash

My best guess:  bash has both an interactive and a non-interactive
mode.  Does bash not allow 'kill' in non-interactive mode?  Any way
around this, if that's true?

I didn't try 'killall'.  That might work, but I guess I want to
understand the underlying problem.  I should try it, though.  It would
be informative to know whether it works or not.

Again, not at all important for me to get this to work.  But I hate
being flummoxed.
-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).



More information about the Discuss mailing list