The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Writing to standard error padmisri Shell Programming and Scripting 2 07-23-2009 05:28 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
failure writing network systems-ftp error DILEEP410 UNIX for Dummies Questions & Answers 0 04-26-2007 11:03 AM
Writing to Standard Error sjung10 UNIX for Dummies Questions & Answers 1 11-10-2006 12:16 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-02-2009
capri_drm capri_drm is offline
Registered User
  
 

Join Date: May 2008
Location: St. Louis
Posts: 78
error in file writing in crontab

Hi ,
I have a crontab job that is trying to write a file and the read it . But the crontab is not able to create any file . But when i run the script as shell then it runs fine . could you tell me what i am missing here .

Here is the script

cat Tablespace_Monitor_ATG

#!/bin/ksh
PATH=/usr/bin::/jcw-data/home/jcwprodi/sqllib/bin:/jcw-data/home/jcwprodi/sqllib/adm:/jcw-data/home/jcwprodi/sqllib/misc:/bin
DB2INSTANCE=jcwprodi
LD_LIBRARY_PATH=:/usr/lib:/usr/sbin:/usr/bin:/lib
export PATH DB2INSTANCE


db2 -x "connect to atg "

db2 -x "drop table daya.tablespace_info "

db2 -x "create table daya.tablespace_info ( Tblsp_name varchar(15) , size_in_mb bigint ,Per_free_space int, used_size_mb bigint )"

db2 -x "select tablespace_name , int((total_pages*page_size)/(1024*1024)) as Size_in_MB ,smallint((float(free_pages) / float(total_pages))*100) as per_free_space, int((used_pages*page_size)/(1024*1024)) as Used_size_MB from table(SNAPSHOT_TBS_CFG('ATG',-1)) where tablespace_type=0 "

db2 -x "insert into daya.tablespace_info select tablespace_name , int((total_pages*page_size)/(1024*1024)) as Size_in_MB ,smallint((float(free_pages) / float(total_pages))*100) as per_free_space, int((used_pages*page_size)/(1024*1024)) as Used_size_MB from table(SNAPSHOT_TBS_CFG('ATG',-1)) where tablespace_type=0 "

echo "TABLESPACE NAME % FREE SPACE" > Tablespace_info_atg
echo " " >> Tablespace_info_atg
db2 -x "select TBLSP_NAME as Name ,PER_FREE_SPACE as Percentage_use from daya.tablespace_info" > Tablespace_info_atg
# It is failing to create the above file Tablespace_info_atg
chmod 777 Tablespace_info_atg
cat /jcw-data/jcwprodi/CRONTAB/Tablespace_info_atg | mail -s "Tablespace Usage For ATG on WAG-PROD-DBCLUSTER " abc_123@yahoo.com

Thanks in advance
  #2 (permalink)  
Old 10-02-2009
thegeek thegeek is offline
Registered User
  
 

Join Date: Apr 2009
Location: /usr/bin/vim
Posts: 440
1. Post the code with code tags for proper visibility.

2. Thing you may miss is, Give the filename with Absolute Path.

3. Dont miss to check FAQ here.
  #3 (permalink)  
Old 10-02-2009
capri_drm capri_drm is offline
Registered User
  
 

Join Date: May 2008
Location: St. Louis
Posts: 78
I tried to run the same script as higher id ( id added to sudoer file ) and that works fine .
It worked when i had /tmp as the path before i wrote the full path too .

Thanks , it works now
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:54 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0