0

First I have to say you that I'm a newbie, but I wanna learn!

I need a script which suppose to check the ftp and sftp communication. This is for 26 ftp and sftp. Script has to execute just 1 times and script suppose to login to ftp and sftp servers using username with password, easy from an extern list.

If ftp works also it has to send an mail and even if it is fail also it suppose to send the mail. Or just a print on screen with status : alive or not alive should be ok.

I am starting with the below script:

I found something like :

"You can use your script with a regular user, creating the file .netrc in the user's homedir (~/.netrc), with the following contents: Code: machine 192.1.1.1 login usename password user-passwd" ...

ftp -v -n <<EOF > ${LOG_FTP} 2>&1
open ${IP_ADDRESS_SERVER}
user ${FTPUSER} ${FTPPASS}
...

EOF

I need now to understand how I can send the email to my email adres or just print on screen the results.

Please can you suggest me the right way or help me write the script.

It would be great help for me.

Thanks in advance for all your help!

Nico

4

1 回答 1

0

您可以使用 sendmail 将电子邮件发送到您的电子邮件 ID。如果您正在使用 bash,请将此行添加到您的脚本中:

#!/bin/bash

然后在终端上执行此操作:

chmod +x <scriptname> #setting executable permission for script
./<scriptname> #executing the script
于 2013-03-13T09:35:06.653 回答