zsh-users
 help / color / mirror / code / Atom feed
* interactive vs cron called
@ 1997-12-18 20:30 Jason Zapman II
  1997-12-18 21:11 ` Frank Li
  1997-12-18 21:47 ` Jason Zapman II
  0 siblings, 2 replies; 5+ messages in thread
From: Jason Zapman II @ 1997-12-18 20:30 UTC (permalink / raw)
  To: zsh-users

Is there a way to tell if a script is being called by cron or via
interactive script?  I'm writing something to tell me when disk usage of
various partitions get's to dangerous levels.  When it's run via cron, I
want it to mail me the results.  If it's interactive, I want it to print
the output to the screen.

Any ideas?

Thanks;
Jason

-- 
     Jason Price    |     If you want to build a ship, don't drum up people 
      Theta Xi,     |   together to collect wood and don't assign them tasks
   Beta, Alpha 449  | and work, but rather teach them to long for the endless 
 jprice@poboxes.com |    immensity of the sea. -- Antoine de Saint Exupery


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: interactive vs cron called
  1997-12-18 20:30 interactive vs cron called Jason Zapman II
@ 1997-12-18 21:11 ` Frank Li
  1997-12-18 21:47 ` Jason Zapman II
  1 sibling, 0 replies; 5+ messages in thread
From: Frank Li @ 1997-12-18 21:11 UTC (permalink / raw)
  To: Jason Zapman II; +Cc: zsh-users

On 18 Dec 1997, Jason Zapman II wrote:

> Is there a way to tell if a script is being called by cron or via
> interactive script?  I'm writing something to tell me when disk usage of
> various partitions get's to dangerous levels.  When it's run via cron, I
> want it to mail me the results.  If it's interactive, I want it to print
> the output to the screen.
> 
> Any ideas?
> 

actually, just have the program output to the screen since crontab will
automatically E-mail any stdout of the program to you anyway. Try it. 

--------------------------------------------------------------------------
Frank Li				Assistant System Admin (Finally !)
E-mail(work)  fli@austin.dsccc.com
E-mail(personal) prefect@ccwf.cc.utexas.edu
What I say is what I think, and no one else's (including the company)
--------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: interactive vs cron called
  1997-12-18 20:30 interactive vs cron called Jason Zapman II
  1997-12-18 21:11 ` Frank Li
@ 1997-12-18 21:47 ` Jason Zapman II
  1997-12-19  1:44   ` Danek Duvall
  1 sibling, 1 reply; 5+ messages in thread
From: Jason Zapman II @ 1997-12-18 21:47 UTC (permalink / raw)
  To: zsh-users

Jason Zapman II <zapman@cc.gatech.edu> writes:
> When it's run via cron, I want it to mail me the results.

I should have made myself more clear.  I know the output of cron is mailed
to the account for which it is run, but I want it mailed to a DIFFERENT
account.  (script to be run as root, mail going to my more often read
account, as this is something along the lines of a warning bell)

Jason

-- 
     Jason Price    |     If you want to build a ship, don't drum up people 
      Theta Xi,     |   together to collect wood and don't assign them tasks
   Beta, Alpha 449  | and work, but rather teach them to long for the endless 
 jprice@poboxes.com |    immensity of the sea. -- Antoine de Saint Exupery


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: interactive vs cron called
  1997-12-18 21:47 ` Jason Zapman II
@ 1997-12-19  1:44   ` Danek Duvall
  1997-12-19  2:34     ` Manual removal ramos
  0 siblings, 1 reply; 5+ messages in thread
From: Danek Duvall @ 1997-12-19  1:44 UTC (permalink / raw)
  To: zsh-users

Checking the return value of tty -s does the trick for me in a similar
situation (distinguishing between command-line invocation and getting
called as a pipe), as it tells you what's attached to stdin.  I'm pretty
sure that cron runs its jobs with stdin not connected to anything, so that
trick ought to work for you, too.

Perl has a builtin function for this, as the -t flag to the [ function.  It
might be useful to have this functionality in zsh, too, but as it's
obviously possible with a functioning unix setup, it's not necessary.

Danek


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Manual removal
  1997-12-19  1:44   ` Danek Duvall
@ 1997-12-19  2:34     ` ramos
  0 siblings, 0 replies; 5+ messages in thread
From: ramos @ 1997-12-19  2:34 UTC (permalink / raw)
  To: zsh-users


hello,

Somebody who is positioned to do so, please manually remove me
from the mailing list. My attempts have resulted in a succesful
"you've been removed" message, but I continue to receive messages.

If you don't understand or don't like this message, please ignore 
it. All flames will be summarily deleted.

Thanks,

--
Alex Ramos
atramos@lucent.com
ramos@ih4ess.ih.lucent.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1997-12-19  3:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-18 20:30 interactive vs cron called Jason Zapman II
1997-12-18 21:11 ` Frank Li
1997-12-18 21:47 ` Jason Zapman II
1997-12-19  1:44   ` Danek Duvall
1997-12-19  2:34     ` Manual removal ramos

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).