How to differentiate error cause of scp? - scp

When scp fails to fetch a remote file, I would like to know whether it is because a connection problem or the remote file does not exist. Is there a simple way to achieve it?
I know to check $?, but in case it is not zero how to differentiate further the cause of error?
Thank you for the help.

Related

Disk I/O with Monit under Linux

I would setup some rules for Monit to alert when disk read / write rate reach specific values.
I'm trying to configure it using their exemples, like:
check filesystem xxx with path /xxx/xxx
if read rate > 90% then alert
I tried many variant but i always get syntax problem when checking it with monit -t.
The first line is good and i can see the filesystem analytics in monit but the alert line always fail.
Someone have an idea about what i'm doing wrong and how to achieve this?
Thanks in advance!
Ok, i just found that this function was not implemented in the version i'm using. So now i'm trying to find a way to update this monit.

Not able to start the IBM HTTP Server

We have taken the Images of the mount points from one existing IBM HTTP Server v8.5 and copied it to another Server. When we tried to start the server using ./apachectl start am not getting any error messages but no I couldn't find any httpd instance running.
When I tried to stop the server I got "httpd (pid 19422?) not running" message.
Changes have been made in httpd.conf by changing the server name.
Please let me know if this Image copying is possible?
If yes, please let me know where else should I have to make the changes?
As long as you keep the path the same, and copy a stopped server, it should be fine.
If you change path, obviously you'll have to change all references to that path in the installation root.
If the server was running, when you copied it, you'll need to zap the PidFile (logs/httpd.pid by default). Usually this is recovered automatically.
Solved this issue, by granting the access to the particular file. It was due to different user who started the server on the parent server from where the Application was cloned.

How to read a large error log file without downloading?

I need to check my apache error log, but the file contains 14GB of data. Downloading will takes ages. Is there any way how I can see what's in the file without downloading?
If you have SSH enabled on the server, just remotely login and either tail or grep the log files.
Do you got a SSH access to your server ? In this case this is easy, use a SSH client like putty and read file directly.
If you only got a FTP access, you can try to use Byte range as defined here : http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35
Of course only if your server supports it.

Does anyone knows any SSH client with reconnect and capable to get password from file?

I need a ssh client capable to reconnect if connection breaks, and, on reconnection, to get password from a file or web address.
Thank You.
Looking around, there does exist autossh.
Rely on autossh to reconnect a broken connections (if everything else is right).
Then you may fetch files or execute any other commands.
Alternatively, you can run a script to loop and check for the port, some like this.
Or you may simply use scp to fetch the required file.

SSh client in C# .net

I want to write a program that accesses my routers and perform some command, while its output is save to file on my disk. I have done this successfully using python pexpect module in linux. I am starting C# .net and want to try over it. Searching google gave me some result on ssh client, but i dont know if any of them can get me the result back ?
Any ideas, i know i shouldnt be asking for any code snippet, just point me in right direction specially if someone has used it to fetch configurations off ssh servers.
You may try the SSH.NET library.