FTP and LOg file creation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP and LOg file creation
# 1  
Old 03-06-2008
FTP and LOg file creation

Hello,

I am new to unix , and I need to create a shell sciprt which helps me FTPing file from LAn to Unix box.
These files r then processed using Perl script and put in a database.
I also need to log the entire process of all the above methods in a log file in the same shell script.
Like , all file names which got tranfered and which did not, directory that opened or falied and the databse connection failed etc instead of a generic msg and send it to the owner via email each time.

Can anyone help me guide thru the process of creating a shell script!!!

Thanks
# 2  
Old 03-07-2008
FTP process

#!/bin/ksh

dir=/dummy
v_data=emp


# 192.0.0.99 is ftp server IP address
# log file will be created as emp.log


# mget to get the files from ftp server
# mdel to delete files from ftp server

# grem all
ftp_data()
{

echo "$1"

# create log file

exec 1>>$dir/$1.log 2>&1

echo "\ncd $FGET"
cd $FGET
time ftp -niv 192.0.0.99 << EOF
user dummy dummy
cd dummy/details
ascii
mget $1*.txt
ls -l
mdel $1*.txt
quit
EOF



}



ftp_data "$v_data"
# 3  
Old 03-12-2008
hi thanks for your help...........sorry cud not reply earlier!!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Users to submit email for ftp creation

hi all, created a bash script to create an ftp account, its here - #!/bin/bash dir=/mnt/sftp group=sftp_users echo "Enter UserName:" read user if id $user ; then echo "$user already exists as you can see above, please re-run the script" exit ... (6 Replies)
Discussion started by: robertkwild
6 Replies

2. UNIX for Dummies Questions & Answers

Log File Creation

Hello :) This is my first post here. I am using MKS Toolkit for ksh and awk programming. The lines that are executed in ksh are shown with a '+' and the values are also shown in the console window. In case of awk, the interpretation/execution of every line is not available. Can you please... (2 Replies)
Discussion started by: Naveen_Hinduja
2 Replies

3. Shell Programming and Scripting

Log file Creation

Hi I have unix script which does execute some OS commands and DB Commands. I would like to create log file for each command execution, Could some one advise how do we create log file. Example Script:###########################################################################... (1 Reply)
Discussion started by: cnrj
1 Replies

4. Shell Programming and Scripting

FTP Log File

Hello, I need help to check content of ftp log files. I forgot to say that I am on Solaris 9. I am using KSH. I have 2 log files. Here is an example of content : LOG File from 21 October -rw-rw-r-- 1 cvbntr xarf 94974 Nov 1 2009 TAG__SC___2006175_0.TAB -rw-rw-r-- 1 cvbntr ... (3 Replies)
Discussion started by: Aswex
3 Replies

5. Solaris

Issue with log creation

Hi, some logs are not getting created under the required folder, which was working fine when i saw last time(15days back). Thought may be some issue with syslog deamon and did lot of R&D. Still not able to fix the bug.:wall: Is there any one to help me out ? Quick response will be appreciated.... (6 Replies)
Discussion started by: Sricharan21
6 Replies

6. Shell Programming and Scripting

FTP script to login and list files to log file

Hi Guys I did a forum search for "ftp scripts" Looked at 8 pages and didnt see anything that would help. Most seem to be logging into a ftp server and transfering files. What I need to do is login to a FTP server. Goto a folder and list it so it showes newest files first. It would be nice to... (4 Replies)
Discussion started by: voorhees1979
4 Replies

7. Shell Programming and Scripting

FTP check if file exists and log it

Hi, I need to create a script that checks if a file exists on an offsite server which only has ftp enabled. I was originally going to use perls Net::FTP class but the client does not have perl installed nor wants it. So, I have to use a shell script which logs into the server, then ... (1 Reply)
Discussion started by: gseyforth
1 Replies

8. Shell Programming and Scripting

Problem in redirecting ftp msgs to a log file

Hi all.. The following set of statements is used in a shell script to ftp a file to a remote machine I want to redirect the ftp messages thrown by the first ftp statement to a log file. As you can see there is a logic downstream to decide if the ftp was a success or not. But i am not... (5 Replies)
Discussion started by: hareeshkumaru
5 Replies

9. UNIX for Dummies Questions & Answers

Regarding Cron log creation

Cameron, I have deleted the cron log file and create a new cron log file as the older was sucking up the disk space. now i have rescheduled the cron job but i dont see any logs on the newly created log file. I am confused what has happened. Can u help me out on this. (0 Replies)
Discussion started by: sanei05
0 Replies

10. Shell Programming and Scripting

Creation of log file under dynamic date folder

HI I want to create a date folder and then a log file under it, which will hold all output of shell script. Say shell script abc.sh runs every day and I want to redirect the output of abc.sh > /opt/bea/wls81/Pkmtest/$(date +%Y%m%d)/ant.log. Here date should always change according to system... (2 Replies)
Discussion started by: pankajkrmishra
2 Replies
Login or Register to Ask a Question