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 | Blog | 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



     I don't think your problem is the 'kill'.  I think it's the program, 
     xargs.  It needs to run under X.
     
     If this were over a network I'd suggest a DISPLAY value in your 
     environment... but I'm not sure.  I'm not sure what xargs does 
     actually.  But your shell is not connecting to X.  Is it running as 
     you or as a seperate user?  Is there a non X program that does 
     whatever xargs does?


______________________________ Reply Separator _________________________________
Subject: Re: 'kill' in bash script
Author:  Ron Peterson <rpeterson at yellowbank.com> at InterNet
Date:    2/3/00 10:01 AM


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).
-------------- next part --------------
Received: from ns.learningco.com ([198.112.0.7]) by mail.learningco.com with
SMTP
  (IMA Internet Exchange 3.12) id 0000E8DB; Thu, 3 Feb 2000 10:15:50 -0500
Received: by ns.learningco.com; id KAA03891; Thu, 3 Feb 2000 10:21:53 -0500
(EST)
Received: from tarnhelm.blu.org(207.31.228.20) by ns.learningco.com via smap
(V5.0)
	id xma003870; Thu, 3 Feb 00 10:21:39 -0500
Received: (from majordom at localhost)
	by tarnhelm.blu.org (8.9.3/8.9.3) id KAA18630
	for discuss-outgoing; Thu, 3 Feb 2000 10:01:40 -0500
Received: from bounce.harvard.net (IDENT:root at bounce.harvard.net
[140.239.141.158])
	by tarnhelm.blu.org (8.9.3/8.9.3) with ESMTP id KAA18627
	for <discuss at blu.org>; Thu, 3 Feb 2000 10:01:38 -0500
Received: from charity.harvard.net (charity.harvard.net [206.137.222.16])
	by bounce.harvard.net (8.9.3/8.9.3) with ESMTP id KAA27169
	for <discuss at blu.org>; Thu, 3 Feb 2000 10:01:32 -0500
Received: from yellowbank.com (wks206.wallacefloyd.com [140.239.109.206] (may be
forged))
	by charity.harvard.net (8.9.3/8.9.3) with ESMTP id KAA25865
	for <discuss at blu.org>; Thu, 3 Feb 2000 10:01:26 -0500
Message-ID: <3899985A.1DB90D74 at yellowbank.com>
Date: Thu, 03 Feb 2000 10:01:46 -0500
From: Ron Peterson <rpeterson at yellowbank.com>
Organization: Yellowbank
X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.14aa1 i686)
X-Accept-Language: en
MIME-Version: 1.0
To: discuss at Blu.Org
Subject: Re: 'kill' in bash script
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-discuss at blu.org
Precedence: bulk



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