Originally Posted by Sleen
Yeah,thats true.I have never used SCP before.Is there suppose to be some configurations at the remote server end,if one was to use SCP?
SCP works over the SSH protocol, so if SSH works, then SCP will also work.
The only requirement that this script adds is that you will need to have public/private key's setup for login, because the script will run in the background and can not accept passwords.
Here is a tutorial covering how to set-up authentication over SSH using keys: http://www.linuxquestions.org/linux/..._Keys_with_SSH
Here is the script that I have running on my computer to get the mail from the remote server:
scp example.com:/var/spool/mail/chadl /tmp/mail_$$
if [ $? -eq 0 ]&&[ -s /tmp/mail_$$ ]; then
cat /tmp/mail_$$ >> /usr/spool/mail/chadl
ssh firstname.lastname@example.org "echo -n '' > /var/spool/mail/chadl"
Note that this script removes the mail from the remote server. In order to change that you can remove line 5 that tells the server to empty the remote mail file.
Just removing this line will cause problems without doing something else, however, as it will result in the same mail being downloaded from the server and thus duplicated on the local mail spool.
I can not think of an easy way to fix this off the top of my head, but I will post if an idea comes to me.