The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Crontab error Cannot execute binary file. raccsdl Shell Programming and Scripting 5 11-13-2007 02:22 AM
how to execute sh script in bash shell via crontab jigarlakhani UNIX for Dummies Questions & Answers 1 06-23-2007 05:50 PM
Need to execute a complete url from crontab nissar Shell Programming and Scripting 2 08-11-2006 02:18 AM
compiled binary file gives "cannot execute binary file" scgupta SUN Solaris 0 07-12-2006 10:59 PM
crontab ..sqlplus cannot execute zikronz High Level Programming 1 04-29-2005 07:03 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-07-2006
Registered User
 

Join Date: Dec 2006
Posts: 20
Can crontab execute binary files?

Hello!

I have an entry on my crontab.

10 00 * * * /bscsprod/bscs/prod/523/bin/tehcron.sh

$ /bscsprod/bscs/prod/523/bin/vi tehcron.sh
nohup teh -t -f > /dev/null &
~
~
~
~
~
~
~
~
"tehcron.sh" 13 lines, 365 characters

but executing the script from the commandline, it works.
$ /bscsprod/bscs/prod/523/bin/tehcron.sh
$ /bscsprod/bscs/prod/523/bin:INFC $ ps -ef|grep teh
bscsprod 4983 1 6 20:15:44 ttyp3 0:00 teh -t -f
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-07-2006
Registered User
 

Join Date: Jan 2004
Posts: 17
what are the permissions on your script? What does cron log to your cron-logfile/syslog?
Reply With Quote
  #3 (permalink)  
Old 12-07-2006
Registered User
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 923
Try adding the standard #! line to the top of your script, as well as these modifications:
Code:
#!/bin/sh
nohup teh -t -f > /dev/null < /dev/null 2> /dev/null & disown
I've been left wondering why my ssh window wouldn't close when it turns out I left things running still using the terminal's stdin and stderr.
Reply With Quote
  #4 (permalink)  
Old 12-07-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,355
Except for Linux, few versions of unix have a /bin/sh that supports disown.
Reply With Quote
  #5 (permalink)  
Old 12-07-2006
Registered User
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 923
Quote:
Originally Posted by Perderabo
Except for Linux, few versions of unix have a /bin/sh that supports disown.
Good to know. Is it that they don't need it, or do they simply not support leaving processes behind?
Reply With Quote
  #6 (permalink)  
Old 12-07-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,355
Quote:
Originally Posted by Corona688
Good to know. Is it that they don't need it, or do they simply not support leaving processes behind?
Neither one. disown is simply a useful command invented by the bash developers and not available in other shells. I would like to see it in ksh. It's not clear why you think this stuff might be useful here though. There is no terminal involved with cron jobs unless the cron job opens one. So there is no controlling terminal to send a hup. ssh is different because a pty is involved. It would take an explicit kill -1 to send a hup to a cron job.

But closing 1 and 2 or redirecting them to /dev/null is a good idea, cron tend to gather these up and mail them to the user. People who write poor cron jobs then get a lot of mail which they never read and it fills up /var.
Reply With Quote
Google UNIX.COM
Reply

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:50 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0