crontab not creating text file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting crontab not creating text file
# 1  
Old 10-05-2012
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

Code:
#!/bin/ksh
hostname > file1.txt 2>/dev/null
hostname >> file1.txt 2>/dev/null
sudo df -h | grep webMethods > file2.txt 2>/dev/null
awk -F, 'NR==FNR{a[$3]=$1;next}$3 in a {$4=a[$3]}1' file1.txt file2.txt >IFC1.txt 2>/dev/null
date


Last edited by Scott; 10-05-2012 at 04:59 AM.. Reason: Code tags
# 2  
Old 10-05-2012
Your script is creating the files, just not where you expect them to be created.
Specify the full absolute path.
Code:
#!/bin/ksh
DESTINATION_PATH=/tmp
hostname > $DESTINATION_PATH/file1.txt 2>/dev/null
hostname >> $DESTINATION_PATH/file1.txt 2>/dev/null
sudo df -h | grep webMethods > $DESTINATION_PATH/file2.txt 2>/dev/null
awk -F, 'NR==FNR{a[$3]=$1;next}$3 in a {$4=a[$3]}1' $DESTINATION_PATH/file1.txt $DESTINATION_PATH/file2.txt >$DESTINATION_PATH/IFC1.txt 2>/dev/null

# 3  
Old 10-05-2012
crontab not creating text file

Thank you ! very much its working now
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help for reformatting text file and creating new format

Hi all, I have an input file like 1,date,company,, 1,date,comapny,, 2,000,,,567,ACT,00,,,,KKG,M1,D45,,67J,+4500000000 2,000,,,567,ACT,00,,,,KKG,M6,D49,,56J,+6000 2,000,,,567,ACT,00,,7,,KKG,M3,D58,,68h,-70000 2,000,,,567,ACT,00,,,,KKG,M9,D95,,34m,0.00 3,total what i require is 1.I... (2 Replies)
Discussion started by: selvankj
2 Replies

2. Shell Programming and Scripting

Help in creating a text file

Hi, I need help in creating a file in specific format. I have following lines in a file 0772 0ECC 0FC8 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 (6 Replies)
Discussion started by: jpkumar10
6 Replies

3. Shell Programming and Scripting

KSH - help needed for creating a script to generate xml file from text file

Dear Members, I have a table in Oracle DB and one of its column name is INFO which has data in text format which we need to fetch in a script and create an xml file of a new table from the input. The contents of a single cell of INFO column is like: Area:app - aam Clean Up Criteria:... (0 Replies)
Discussion started by: Yoodit
0 Replies

4. UNIX for Dummies Questions & Answers

creating text file with content from script

hi, can somebody tell me how I can create a text file with content from Bash script. The file should be prefilled with information such as current date and time then leaving the user ability to input more data right below those prefilled content. thank you :) (0 Replies)
Discussion started by: s3270226
0 Replies

5. Shell Programming and Scripting

Help with creating a text file in perl with file creation date.

Hi, I am quite new to Perl scripting and i need to create a .TXT file using perl, with fields (A,B,C,D,E), and this text file should be named with current file creation date "XYZ_CCYYMMDD.TXT" (i.e.XYZ_2011042514:33 PM). Can anyone who has done this, please share their expertise on this... (5 Replies)
Discussion started by: msrahman
5 Replies

6. Homework & Coursework Questions

creating search script for a text file

I am aware of the stipulations regarding homework, however I am completely stuck and do not know how to even begin the following (in bash): Create a script that searches for a text file with most occurrences of a given keyword. Any help is greatly appreciated. Thank you (1 Reply)
Discussion started by: hybridoutlaw
1 Replies

7. UNIX for Advanced & Expert Users

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. sh somescript.sh 1> /location/somefile.log Evrytime the cronjob triggers this script, It creates a zero byte file in the... (4 Replies)
Discussion started by: DSDexter
4 Replies

8. Shell Programming and Scripting

Creating a text file in Local Drive

Hi All, I am new in Shell Script. I have a ksh script running in the Unix Server and basically in that script I need to create a text file but the text file has to be generated in the local PC (the user computer such as in C:\ drive). I have no idea on how to do it and I need it pretty urgently.... (2 Replies)
Discussion started by: yramli
2 Replies

9. UNIX for Dummies Questions & Answers

build crontab from a text file

We are reorganizing our UNIX Crontab file by first making changes in a word pad text file. The intent is to then copy it back to Crontab. Will this work? Copy and Paste does not seem to work. (4 Replies)
Discussion started by: John Connors
4 Replies

10. UNIX for Dummies Questions & Answers

Creating flat text file (ASCII)

Hi everybody. I need help and I hope someone is willing to help me out here. My wholesale company is currently moving to new software. The old software is running on a UNIX platform. We need to migrate data from the UNIX system, but our former software provider refuses to assist the data... (5 Replies)
Discussion started by: Wdonero
5 Replies
Login or Register to Ask a Question