Results 1 to 4 of 4
Hi, I want to write a shell script to achieve the following Local server - IP 192.168.10.20 - FTP script running in this server - Log files location: /logs/omni_logs/fullcdr/ - ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-25-2012 #1
Shell Script to Transfer Files ( FTP)
I want to write a shell script to achieve the following
- IP 192.168.10.20
- FTP script running in this server
- Log files location: /logs/omni_logs/fullcdr/
- Log files name: [yymmdd][seq_no]_WN_03_FULL_LOG (eg-12110101_WN_03_FULL_LOG)
- IP 18.104.22.168
- User name: ftpuser, Password: mytest
- Log transfer location: /logs/ftp_log/
- Log files name: [yymmdd][seq_no]_WN_03_FULL_LOG
- There should be a single retry attempt in 20 seconds for ftp connect if first attempt is failed
- Transfer all files in local location which have no extension “.sent” to remote location
- Check whether files have transferred completely and files are available in remote location
- Rename transferred files in local location with “.sent” as extension so next time script will not attempt
to transfer already transferred files.
I have written a script partly but need corrections and enhancements or a totally different script. Could you assist me pls?
#!/bin/bash ftp -u ftpuser -p mytest ftp://22.214.171.124/logs/ftp_log < /logs/omni_logs/fullcdr/*[LOG$] cd /logs/omni_logs/fullcdr mv *[LOG$] /logs/omni_logs/fullcdr/*[LOG$].sent
- 11-25-2012 #2
- Join Date
- Nov 2012
didn't you ever connect to a ftp server?
ftp connection are not the same as if you logged on a machine.
ftp commands are not the shell commands, when connected type in ?
(question mark) so every command available will be printed on screen.
I suggest you do more research about how work ftp and "ftp scripts".
- 11-25-2012 #3
- Join Date
- Jun 2012
- SF Bay area
If you can switch to using "scp" instead, you'll be much, much happier. It's better suited to the sort of task you seem to have in mind. Is that an option?
Also, if those are the real ip, user and password then you should change the password. While people on this site are by and large well intentioned folks, it's really a bad idea to post a working user/password combo to a public forum.
Last edited by cnamejj; 11-25-2012 at 09:04 AM. Reason: Additional suggestion added, warning about posting user/password info...
- 11-25-2012 #4