capture shell output in cron entry | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


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

capture shell output in cron entry

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 04-16-2008
steve72 steve72 is offline
Registered User
 
Join Date: Apr 2008
Last Activity: 16 May 2012, 11:26 AM EDT
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
capture shell output in cron entry

Hey all,
I'm running scripts from cron and I want to capture the output from the 1 file handle. Ex. * * * * * /test.sh 1>test.log. I also want to append a formatted date to the file. * * * * /test.sh 1>test.log_date +%m%d%y but I keep keep getting the output as if I had just added the date command. What I want is test.log_041608 what I get is test.log_Wed Apr 16 14:00:00 EDT 2008. I've tried all sort of combinations but still no luck. I can get it to work when I run the command from a shell script manually. Is it an environment setting issue?? Does anyone else have this setup? Thanks.
Sponsored Links
    #2  
Old 04-16-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
 
Join Date: Mar 2008
Last Activity: 28 March 2011, 6:41 AM EDT
Location: /there/is/only/bin/sh
Posts: 3,653
Thanks: 0
Thanked 10 Times in 8 Posts
Try adding a path to make sure you are getting the same date command at the prompt and in the script.

Your question is rather unreadable without code tags. You also seem to be missing the backticks. I assume this is not the problem really.
Sponsored Links
    #3  
Old 04-16-2008
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
 
Join Date: Mar 2005
Last Activity: 5 July 2014, 11:14 AM EDT
Location: classification algos
Posts: 3,203
Thanks: 19
Thanked 30 Times in 27 Posts
should be something like


Code:
touch abc_`/usr/bin/date +%m%d%y`

    #4  
Old 04-17-2008
steve72 steve72 is offline
Registered User
 
Join Date: Apr 2008
Last Activity: 16 May 2012, 11:26 AM EDT
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Yep, using backticks. Here's the full cron entry.
/ora-arch/oracle/backup/rman/scripts/pf1_rman_incremental.sh db20 1 1>/ora-arch/oracle/backup/rman/log/db20_lev1_rman_backup_`date +%m%d%y`.log 2>&1

Kinda hard to read in this text window. I did the touch command and it works. I can also run this from a shell script and get the desired output. Just not working in cron. I even tried running the /home/username/.profile before the command. No dice.
Sponsored Links
    #5  
Old 04-17-2008
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Advisor  
Forum Advisor
 
Join Date: Feb 2005
Last Activity: 24 October 2014, 7:17 PM EDT
Location: Foxborough, MA
Posts: 7,667
Thanks: 152
Thanked 586 Times in 551 Posts
Maybe this will help.
Sponsored Links
    #6  
Old 04-17-2008
steve72 steve72 is offline
Registered User
 
Join Date: Apr 2008
Last Activity: 16 May 2012, 11:26 AM EDT
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
I see. I'll try to rebuild my scripts to work around the env settings. Thanks everyone.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
cron entry everurs789 UNIX for Dummies Questions & Answers 3 01-24-2011 10:53 AM
User entry in both cron.allow and cron.deny ksvaisakh Solaris 5 12-25-2009 12:39 PM
Capture Shell Script Output To A File rajan_san Shell Programming and Scripting 4 01-13-2009 12:30 PM
cron entry rujus UNIX for Dummies Questions & Answers 7 01-29-2007 04:36 PM
Cron entry rramanuj AIX 1 11-01-2005 01:35 PM



All times are GMT -4. The time now is 06:10 AM.