Either method is possible; I'd prefer the second with apcaccess as it describes the actual status of the UPS while the log could be delayed / overwritten / have other, meaningless lines. You also seem to have it in your script but commented out. Unfortunately, I don't know apcaccess and so can't tell which info indicates a "power out" status and maybe more (mayhap on top of "STATUS: ONLINE", one of the bits in STATFLAG might give deeper insight?).
Assuming it were the STATUS line, and stealing from your script, try (untested, and not sure the sh shell will correctly run this, you may need e.g. bash)
Remove the echo when happy with the result.
Final comment: the "shebang" in your script #!/bin/sh needs to be in the very first line to become effective, i.e. determines the shell to be run to execute your code.
Hello,
I'm trying to write a script that checks for previous instances of the same script which may still be running (this script is scheduled to run every 30 minutes). I want to somehow use the pid from each instance to make sure the previous one isn't running before continuing with my... (5 Replies)
When I try to send mail, sendmail delays a lot. After monitoring syslog, I noticed that sendmail starts with this first message... waits a minute and gives the second message... waits another minute and then sends off the email. How do I correct this in sendmail or completly disable it. I'm sending... (0 Replies)
Hi All,
I have a requirement to perform the following checks.
Input file is a "|" delimited file and looks like this.
A|c1|c2|c3|....
B|G1|G2|G3....
C|H1|H2|H3...
A|c4|c5|c6|....
B|G4|G5|G6....
C|H4|H5|H6...
Now the check is to see if all the "A" records have a corresponding B... (7 Replies)
Ok, so this may be an unusual request. But I have a certificate that expires sometime in may of 2011. Now, i have to monitor this certificate and alert when the current time is within 30 days of may 20, 2011.
#!/usr/bin/perl
#
use Time::Local;
#
$sec=59;
$min=59;
$hours=23;
$day=31;... (3 Replies)
Hi.
I'm triyng to make a Bash Script that checks (recursively) the MD5 from all the files in a certain directory and compare them against some other check that should be already done and saved in a file.
I've reached to the point where i have the MD5 from the file and the MD5 that the script... (1 Reply)
Hi ,
I need a script which performs below activity
I have one file named "testfile" in 9 different directories with same name.
I want to perform below action with each testfile of each directory.
if ; then
mv listfiles listfiles_`date +%b%y`
else
echo No Such files
fi
... (4 Replies)
Hi ,
I need a script for processing below scenario.
I have to check daily by doing ftp IP to check it is logging or not.
So i want this activity to be automated such that if login succesful i will get "FTP LOGIN SUCCESS" in a log file and if fails i want the error message in the same log... (1 Reply)
hi ,
i want write the script which automatically send an alert mail to my mail id when there is low memory available.
things which i am able to implement -:
i got the output of current memory status into one file . Than i break down the required coloumn and again send it in another file.
My... (1 Reply)
Hi All,
I have a cron job set up which is set to run every 10 seconds.
What I need to do is have the script do a check to see if it is already running such that if it is running it wont fire up additional instances and processes according to its normal process.
For example if I have a script... (4 Replies)
Hi,
I'm trying to send out mails from my server using mailx, however everytime I send one, it appears to be held in the /var/spool/mqueue for 44 mins before being sent.
I'm quite new to sendmail, so don't really know where to start with this /var/log/syslog displays the following:
Dec 16... (4 Replies)