FTP Script
Greetings,
I am trying to create SFTP script to test the SFTP connectivity issue is that I cannt able to satisfy both if and elif condition Suggest me where iam missing in the script. |
Welcome to LinuxQuestions.
Just some observations. Is your server configured for public/private keys? The -b option is for non interactive commands so it does not appear to be used correctly. What is the contents of /SFTP/currentstatus.dat? And sftpSTATUS is never updated with the latest status. To prove sftp functionality are you trying to send or receive a file from the server? |
SFTP is configured for Public key we are accessing the external SFTP server from our linx boxes.
yes that's true Sftp STATUS never updated. We just connect to SFTP and we are not receiving any file from the server |
Quote:
Code:
echo quit > /tmp/sftpcmds.$$ - Using fixed values instead of getopts ('help getopts') and user input ('help read'), - Probably should be using FUSE SSHFS or AutoSSH, - Not business-like text but using unnecessary text amelioration like "###" and "---" lines, - Duplicate echo commands, - No timeouts / retesting: your "Dear Team," is not going to like you sending emails often. *Search LQ for "Bash scripting guides". |
Also I am thinking to use export , is it possible to store the sftpstatus output within the script to avoid the /tmp usage
|
Script for SFTP Status checking
Looking for a Script to check SFTP status with EXPORT to satisfy both
the below conditions |
not sure i understand ?:
Quote:
|
We have to monitor the SFTP server connectivity. Everday we have to monitor whether the connectiy was succesfull or not. if it's successul or failed it has send alert message for failed condition and also for the restoration of the services
|
the variable $? contains the exit status of the previous command.
Code:
scp user@server.net |
I have written script some how I was not succesfull. Please look into it and correct me if my coding is wrong to execute
|
Change
Code:
#!/bin/bash Code:
#!/bin/bash -vxe Code:
/path/to/script 2>&1 | tee /path/to/log.txt |
i have a general suggestion that isnt specific to your error but wouldnt it much simpler to use scp since this is automated ?
even mounting thru sshfs would be easier. |
Quote:
i usually add lines like echo enter if / echo var = $var... and then comment them out later. |
All times are GMT -5. The time now is 07:04 AM. |