Sponsored Content
Top Forums UNIX for Advanced & Expert Users Crontab Error - creating zero byte log file Post 302363867 by methyl on Wednesday 21st of October 2009 01:01:41 PM
Old 10-21-2009
1) In most unixes the errors will be in root mail .
2) As suggested above, refer to the script name by absolute path unless the script happens to be in the limited default path available in cron.
3) There may also be need to set PATH in the script or refer to commands by absolute path,
4) You don't need the "sh " in front of the command. cron defaults to "sh".
5) If you want to capture all output from the script you will need to redirect the error channel too.

Suggested outline for the command field in the crontab line:

Code:
/absolute_path_to_script/somescript.sh 2>&1> /location/somefile.log

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with a shell script for creating a log file

I have a schell script that runs continously on an AIX system. It is actually started from another shell script with the "ksh -x" command and then I just write the output to a log file. This causes the log files to be filled with mostly useless information. I would like to modify this script to... (2 Replies)
Discussion started by: heprox
2 Replies

2. Shell Programming and Scripting

help with creating new log file

Hello, The problem I am having now is... daily log file (xxxx.0228) exceeds it's max limit, stops logging and brings the daemon down. It won't start the daemon untill a new log file is created which happens at midnight. Once new daily log file starts, it brings up the daemon back up and starts... (0 Replies)
Discussion started by: john89011
0 Replies

3. Shell Programming and Scripting

crontab is not creating runtime files which are in script..

this is the output i am getting here.. cp: cannot create /wls_domains/eoigw/eoigwsA/deliv/cron/MailingScript/eoigwsA_Health_Status_Report.html: Permission denied /wls_domains/eoigw/eoigwsA/deliv/cron/MailingScript/ /wls_domains/eoigw/eoigwsA/deliv/cron/MailingScript/GenerateReport.sh:... (6 Replies)
Discussion started by: surekha268
6 Replies

4. Shell Programming and Scripting

Check if 2 files are identical byte-to-byte?

In my server migration requirement, I need to compare if one file on old server is exactly the same as the corresponding file on the new server. For diff and comm, the inputs need to be sorted. But I do not want to disturb the content of the file and need to find byte-to-byte match. Please... (4 Replies)
Discussion started by: krishmaths
4 Replies

5. Shell Programming and Scripting

Remove a byte(Last byte from the last line)

Hi All Can anyone please suggest me how to remove the last byte from a falt file .This is from the last line's last BYTE. Please suggest me something. Thank's and regards Vinay (1 Reply)
Discussion started by: vinayrao
1 Replies

6. 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

7. Shell Programming and Scripting

crontab not creating text file

while running the following code in ssh crontab, Its running successfully but its not creating text file IFC1.txt, file1.txt, file2.txt while running manually its working. please help me #!/bin/ksh hostname > file1.txt 2>/dev/null hostname >> file1.txt 2>/dev/null sudo df -h | grep... (2 Replies)
Discussion started by: elango963
2 Replies

8. UNIX for Dummies Questions & Answers

Crontab Logfile Not Creating

I have a script file (fmlist.sh), i need the output of this script to write to a logfile (Mod_Alm_log.txt). If i execute the below manually it works, but when using in crontab the file is empty. cd /home/dreid12/als/Modernization && ./fmlist.sh > Mod_Alm_log.txt Any ideas? This is unix on a... (1 Reply)
Discussion started by: mytouchsr
1 Replies

9. Shell Programming and Scripting

Log file being not generated in crontab

My shell script it.sh #!/bin/sh ORACLE_HOME=/var/opt/oracle/product/10g; export ORACLE_HOME PATH=$PATH:$ORACLE_HOME/bin:/bin:/usr/bin; export PATH today=`date "+%m-%d-%Y %H:%M:%S"`; export today CUR_DIR=$1; export CUR_DIR LOG_FILE=error.log; export LOG_FILE # Direct script output to... (4 Replies)
Discussion started by: rafa_fed2
4 Replies

10. UNIX for Dummies Questions & Answers

Log file generation from crontab

Hi All, Like to enquire whether is it possible for me to append another log file(log2.lst) using my below crontab? I will need to have 2 log files generated; one to collect the daily appended output and another log file that contains only the daily output. Original Code: 00 01 * * *... (2 Replies)
Discussion started by: snowfrost88
2 Replies
cron(8) 						      System Manager's Manual							   cron(8)

NAME
cron - The system clock daemon SYNOPSIS
/usr/sbin/cron DESCRIPTION
The cron daemon runs shell commands at specified dates and times. Commands that are to run according to a regular or periodic schedule are found within the crontab files. Commands that are to run once only are found within the at files. You submit crontab and at file entries by using the crontab and at commands. Because the cron process exits only when killed or when the system stops, only one cron daemon should exist on the system at any given time. Normally, you start the cron daemon from within a run command file. During process initialization and when cron detects a change, it examines the crontab and at files. This strategy reduces the overhead of checking for new or changed files at regularly scheduled intervals. The cron command creates a log of its activities. The cron daemon must be started from the system startup scripts because it must begin execution without a login user ID set. The cron daemon starts each job with the following process attributes stored with the job by the invoking process: Login user ID Effective and real user IDs Effective and real group IDs Supplementary groups It also establishes the following attributes from the authentication profile of the account associated with the login user ID of the invok- ing process: Audit control and disposition masks Kernel authorizations DIAGNOSTICS
The at and batch programs will refuse to accept jobs submitted from processes whose login user ID is different from the real user ID. FILES
Specifies the command path. Main cron directory Directory containing the crontab files. List of allowed users. List of denied users His- tory information for cron Queue description file for at, batch, and cron RELATED INFORMATION
Commands: at(1), crontab(1), rc0(8), rc2(8), rc3(8) Files: queuedefs(4) delim off cron(8)
All times are GMT -4. The time now is 01:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy