[SATLUG] small script, baffled problem.

Richard Suberg rsuberg at satx.rr.com
Fri Aug 13 07:16:05 CDT 2010

I can see the use of variables, file status indicator isn't a bad idea,
because this task either exits quick( failed mount), does some work (they
updated stuff), or does a whole LOT of work (recovering from bad files)...
But what is the difference between set $var and export $var? I haven't seen
a lot about that, but have seen both used in various places.

-----Original Message-----
From: satlug-bounces at satlug.org [mailto:satlug-bounces at satlug.org] On Behalf
Of Robert Pearson
Sent: Friday, August 13, 2010 3:26 AM
To: The San Antonio Linux User's Group Mailing List
Subject: Re: [SATLUG] small script, baffled problem.

On Thu, Aug 12, 2010 at 9:14 PM, Richard Suberg <rsuberg at satx.rr.com> wrote:

> Thanks, what I did was put the ; in there, then was able to take out the
> exit and put in an else clause...now to have the thing let me know when it
> fails (would be in the else clause) but how to do it? telnet to the mail
> server? This box just sits there serving documents, has apache loaded, but
> no external mail setups.  I knew it was going to be something simple...
> Richard
I am confused about whether you still have a problem so just ignore this if
you don't.
For your case I would simply write the "else" exit status to a file or a
variable and write the value of that to the file and send that file, if it
exists to where the other files are going - need to check it is new and not
send old file. If you don't need a "status history record" then just
overwrite the same file name on the source end. "Status history records" are
good for repetitive tasks management.
What normally happens on remote unattended scripted processes is the "finish
status - good or bad" and any information you might feel is important over
and above status, like how many files sent, how long it took, etc., is
captured in a file and sent. Then a script on the destination end polls for
that "status file" and "if found newer than the previous one or today's
date, etc." emails it to you.
The polling script on your end also checks to see if that "new" file is
found within a reasonable time based on historical times If not it emails
you to check on the process...
So you either get the complete exit status or a warning that the process is
Try to make this code as generic as possible by setting variables at the
start of the script for "destination", "file name" "status", etc. That makes
this handy script easily re-usable for all kinds of things by just changing
the values of the variables and adding or deleting them as well.
SATLUG mailing list
SATLUG at satlug.org
http://alamo.satlug.org/mailman/listinfo/satlug to manage/unsubscribe
Powered by Rackspace (www.rackspace.com)

More information about the SATLUG mailing list