![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| error in file writing in crontab | capri_drm | Shell Programming and Scripting | 2 | 10-02-2009 03:26 PM |
| Check if 2 files are identical byte-to-byte? | krishmaths | Shell Programming and Scripting | 4 | 09-04-2008 01:37 AM |
| Run perl file in Crontab error. | raccsdl | Shell Programming and Scripting | 2 | 11-13-2007 07:07 AM |
| Crontab error Cannot execute binary file. | raccsdl | Shell Programming and Scripting | 5 | 11-13-2007 06:22 AM |
| Error while creating .tar file using script | Rakesh Bhat | Shell Programming and Scripting | 1 | 12-30-2005 01:40 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Crontab Error - creating zero byte log file
Hi,
I am trying to run a shell script using the crontab scheduler, and I am redirecting the log of the script output to some temp log file using the following command. Code:
sh somescript.sh 1> /location/somefile.log Code:
sh somescript.sh > /location/somefile.log Code:
rm -rf <somefile> Last edited by pludi; 4 Weeks Ago at 07:55 AM.. Reason: code tags please... |
|
||||
|
You should use absolute path, unless you have the PATH variable defined.
We have it specified in lot of places such as ping from cron |
|
||||
|
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 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|