|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
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
|
|||
|
|||
|
should be something like Code:
touch abc_`/usr/bin/date +%m%d%y` |
|
#4
|
|||
|
|||
|
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 | |
|
|
#6
|
|||
|
|||
|
I see. I'll try to rebuild my scripts to work around the env settings. Thanks everyone.
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| 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 |
|
|