Hi all,
I'm trying to write a script that outputs an XML file to be put on a 'service status' page. I have nearly everything in place now - I am successfully checking web servers, DNS servers, DB servers, proxy servers but the last thing I am struggling with is FTP.
I have fallen back to using telnet'ing port 21 as FTP does not have a robust return code system.
I am running this command from the command line which works perfectly:
If the server responds on that port it will print MOTD and my command picks that up and outputs the number '1'. I have changed the MOTD to MTOD and the grep doesn't pick it up and outputs 0, therefore I have a valid return - either 0 or 1 which lets me know if FTP is up or not on the remote server.
However, if I try to run this from within a bash script:
then it always returns 0 as if the grep does not find anything.
Any pointers would be much appreciated.
Thanks
------------------------------------------
Somethings come from nothing, nothing seems to come from somethings - SFA - Guerilla
roycrom
I'm trying to write a script that outputs an XML file to be put on a 'service status' page. I have nearly everything in place now - I am successfully checking web servers, DNS servers, DB servers, proxy servers but the last thing I am struggling with is FTP.
I have fallen back to using telnet'ing port 21 as FTP does not have a robust return code system.
I am running this command from the command line which works perfectly:
Code:
echo ^] | telnet ftp.server 21 | grep MOTD | awk {'print $1'}
However, if I try to run this from within a bash script:
Code:
#!/bin/bash
echo ^] | telnet ftp.server 21 | grep MOTD | awk {'print $1'}
Any pointers would be much appreciated.
Thanks
------------------------------------------
Somethings come from nothing, nothing seems to come from somethings - SFA - Guerilla
roycrom