Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

'kill' in bash script



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).




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org