Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-28-2011, 11:59 AM   #16
Registered: Dec 2010
Posts: 64

Rep: Reputation: 6

I'm not sure how accurately you want to monitor *the server*, but just one service (ftp). In the first case, you can just ping/fping it, and in the second case, you can telnet port 21 with some tools. Depending on your lan, you can even consider installing nagios, which has lots of plugins for checking remote services. Maybe you can even "hire" the check_ftp binary, which I paste a sample output from my nagios server:

# /usr/lib64/nagios/plugins/check_ftp -H ftp
FTP OK - 0,002 second response time on port 21 [220 Microsoft FTP Service]|time=0,001621s;;;0,000000;10,000000
# echo $?
# /usr/lib64/nagios/plugins/check_ftp -H foo
FTP CRITICAL - Invalid hostname, address or socket: foo
# echo $?

so you can get from the first sample (a real windows server) and the second (wrong name "foo") the output and/or the exit status to check if the operation has been successful.
Old 04-29-2011, 09:03 AM   #17
LQ Newbie
Registered: Apr 2011
Posts: 7

Original Poster
Rep: Reputation: 0
Speedy64 - interesting idea, but that would require me to install FTP server services on every Windows server that I want to use this script on. The FTP client is built into the Windows operating system so I don't have to install anything there. Also, the file I upload will contain the recipient info for the email and I was thinking of having quite a few Windows boxes hooked up this way and then looping through them on the Linux server.

Thanks for the suggestions.
Old 04-30-2011, 10:17 PM   #18
LQ Newbie
Registered: Apr 2011
Location: Kentucky
Distribution: Ubuntu 10.10
Posts: 7

Rep: Reputation: 0
I think the idea still works. Instead of FTP use something else. My script, using a text file with list of DBs, connects to all my databases and pulls data for one global report. If connection fails then DB need attention.

The advantage is that you will have one job to change/start/stop. One point of failure.
Old 04-30-2011, 10:59 PM   #19
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
I wrote an ogg2mp3 script, which contains a function to evaluate the tagname=value output of ogginfo.
   # clear out old tags
   # the tags returned by ogginfo are of the form NAME=VALUE.
   # put single quotes around the values to encapsulate white space.
   # eval will set the tag variables ALBUM, ARTIST, DATE, GENRE, TITLE
   # remove massive coverart info
   eval $(ogginfo ${1} | sed '/COVERART/d;/\t=/d;/[A-Za-z]*=/!d;s/^\t//;s/^\(.*\)=\(.*\)$/\U\1\E="'"\2"'"/' )
The first part '/COVERART/d;/\t=/d;/[A-Za-z]*=/!d;s/^\t// cleans up the output. The second part s/^\(.*\)=\(.*\)$/\U\1\E="'"\2"'"/ inserts single quotes around the RHS. The result is eval'ed, setting the variables.
Old 05-01-2011, 07:55 PM   #20
LQ Newbie
Registered: Apr 2011
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks for all your help guys. I added quotes to the right side of the source text file and used Grail's idea of just executing it. Keepin' it simple!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sed append text to end of line if line contains specific text? How can this be done? helptonewbie Linux - Newbie 4 10-23-2013 02:48 PM
parse text between html wakatana Programming 4 10-27-2009 09:12 AM
How to parse text file to a set text column width and output to new text file? jsstevenson Programming 12 04-23-2008 03:36 PM
Can you parse text with regex? raypen Slackware 4 03-21-2006 01:26 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:53 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration