I have done my easy script in bash - this script should transfer the file with the specific new name from server 1 to remote server 2.
Can someone help with this and transfer all script to Python.
 #!/bin/bash
path=/opt/log #Im in dir /opt/log
fdate=$(date +%Y%m%d -d "-1 day") # yesterday date
file=maillog-$fdate     # log from yesterday which will be transfer to remote server
cp $path/$file /tmp/$HOSTNAME-$file  # copy $file to /tmp with the specific name of $HOSTNAME + $File name
gzip /tmp/$HOSTNAME-$file      # ZIP the file
rserver=hansus@hansus.edu.net    # remote server 
rpath=/opt/log/maillog # remote path
scp /tmp/$HOSTNAME-$file.gz $rserver:$rpath # copy the file to remote server to remote path
rm /tmp/$HOSTNAME-$file.gz # clean the /tmp dir
 #Done
 
     
     
    