Log error from cron job into log file


 
Thread Tools Search this Thread
Operating Systems Solaris Log error from cron job into log file
# 8  
Old 03-19-2014
Code:
cd /opt/HDVM/bin/; (./HiScan -s exoc:2005 -t /var/opt/HDVM/log/HiScan.msg >> /var/opt/HDVM/log/HiScan.log) \
 2> /var/opt/HDVM/log/HiScan.err

# 9  
Old 03-19-2014
Log error from cron entry into log file

@vbe

correct if I am wrong, I just need to replace my original syntax with
Code:
/datax/vendor/dump.sh 2 > /datax/vendor/err.log

to only log errors?
# 10  
Old 03-19-2014
You are not interested by the output of dump.sh?
# 11  
Old 03-19-2014
in my code
Code:
 2> /var/opt/HDVM/log/HiScan.err

this file should always be of 0 size, since it is for errors only the last execution is important (no need of history...) thats is why you have also the log file...
# 12  
Old 03-19-2014
You also need to ensure that you have 2> rather than 2 > The former will redirect standard error, the latter will give the value 2 as a parameter and then redirect standard output.



Robin
# 13  
Old 03-19-2014
Log error from cron entry into log file

Smilie ... would it be
Code:
/datax/vendor/dump.sh >> /datax/vendor/dump.log \ 2> /datax/vendor/err.log

# 14  
Old 03-19-2014
@fretagi.......the point that vbe made was that if you mix the normal output of the script with the error output of the script, then errors are not easily spotted because you have to read the whole damned thing. Therefore, vbe recommends sending the normal output to one file, and error output to another file.

Sorry to intrude.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Web Development

How to log http 404 error to a separate log file?

Apache Web Server: how to log http 404 error to a separate log file and i do not want to log in access.log please advice. (2 Replies)
Discussion started by: raghur77
2 Replies

2. UNIX for Dummies Questions & Answers

Error while running a script through cron job

Hi Team, When i am running the below query manually it is giving me the right output i.e. export PATH=/usr/sbin:/usr/bin:/sbin:/bin:$PATH ADMIN=abc@abc.com CPU_HIGH=`sar|awk '{print $9}'|sort -n|head -5|sed -n 5p` CPU_MAX=`echo "scale=3; 100-$CPU_HIGH" | bc` CPU_LOW=`sar|awk '{print... (13 Replies)
Discussion started by: Ekamjot
13 Replies

3. Shell Programming and Scripting

Shell Script to grep Job File name and Log File name from crontab -l

Hello, I am new to shell scripting. I need to write a shell script where i can grep the name of file ie. .sh file and log file from crontab -l. #51 18 * * * /home/oracle/refresh/refresh_ug634.sh > /home/oracle/refresh/refresh_ug634.sh.log 2>&1 #40 17 * * * /home/oracle/refresh/refresh_ux634.sh... (1 Reply)
Discussion started by: guptra
1 Replies

4. Shell Programming and Scripting

Capture all error message in Log file and send the Log file by email

Hi I have a requirement to write a script to capture all errors in a Logfile and send the file in email. If there is any error occurred the subject of email will be ERROR , If there are no error occurred the subject of email will be SUCCESS. So I created a Log file and put the Appropriate... (2 Replies)
Discussion started by: dgmm
2 Replies

5. Shell Programming and Scripting

Cron Log file

Hi Iam new to unix .please help me in writing a script.Suppose there are 100 scripts in a cron file which are scheduled to run at different times,different dates . I need to monitor all the scripts daily whether they ran or not if ran whether its sucessfully ran or not . if the script hasnt... (2 Replies)
Discussion started by: mskalyani
2 Replies

6. UNIX for Dummies Questions & Answers

Showing a daily backup job from a unique log file.

Hi guys, I´m a newbie in Linux, but I´m trying to solve some problems studying on my own, but I´ve had some problems with AWK. Look, I have one single backup log file per server and I want to make a daily delection from the last backup job to show in a intranet of my work. The log files are from... (0 Replies)
Discussion started by: metalfreakbr
0 Replies

7. Shell Programming and Scripting

cron job error

HI am having a script file which is ok if i run from the server manually like <root@hostname:/space/canvas/home/lbs/current/internalcdrbackup/LES_CDR_Configuration/0/MSISDNcdrCount > /space/canvas/home/lbs/current/internalcdrbackup/LES_CDR_Configuration/0/MSISDNcdrCount.txt the... (2 Replies)
Discussion started by: aemunathan
2 Replies

8. Shell Programming and Scripting

Error in cron job;

Hi All, please help me out with this problem. While running my mail_out_original.ksh in CRT window, it disconnects from the server saying not connected Here is my code : (please see the attachment) ____________________________________________________________ #!/bin/ksh ## Load... (1 Reply)
Discussion started by: shruthinagaraj
1 Replies

9. UNIX for Dummies Questions & Answers

Error in cron job;

Hi All, please help me out with this problem. While running my mail_out_original.ksh in CRT window, it disconnects from the server saying not connected Here is my code : (please see the attachment) ____________________________________________________________ #!/bin/ksh ## Load... (1 Reply)
Discussion started by: shruthinagaraj
1 Replies

10. Red Hat

LAuS error messages in /var/log/cron

I'm running RedHat Linux Enterprise Server ES Version 3 and I've stopped the audit service. Now I'm getting the following error messages in /var/log/cron May 17 07:01:01 pam crond: LAuS error - do_command.c:243 - laus_log: (19) laus_log: No such device May 17 08:01:01 pam crond: (root) CMD... (1 Reply)
Discussion started by: soliberus
1 Replies
Login or Register to Ask a Question