Skip to Content
Author's profile photo Former Member

Useful ftp script for some daily transfers.

Useful ftp script to transfer files from SAP server daily to another file server.

In my case I transferred daily audit logs from SAP ERP server to another file server.

1)Create a .netrc file under root user $HOME directory / .  There is sample netrc file under /usr/samples/tcpip/ .

Register file server IP and login credentials:

machine <IP> login <username> password <password>


Its rights should be 600 (rw- — —) . Otherwise we get an error like:


chmod 600 .netrc

Then we can immediatley login to file server (which we’ll transfer our audit files to).

2)Here is the little script /tmp/ :


#Calculating YESTERDAY variable value

YESTERDAY=`TZ=bb24 date +%Y%m%d`


#Login to file server to put the latest audit file there

ftp <IP> << cmd


lcd /usr/sap/SID/DVEBMGS<SN>/log

cd /SID



3)Crontab entry to run this script daily:

crontab -e

#Sending Daily Audit Logs to XXXXX Server

0 7 * * * /tmp/ 1>/dev/null 2>/dev/null              

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.