script to mail monitoring output if required or redirect output to log file
Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions.
Quote:
==== WPAR Status Check ===== ====== MMDDYYYY HH:MM ======
**** WPAR state Active: usprd02 usprd03
2 WPARs are in A-Active State
**** WPAR state Defined/Transition/Broken: usprd04 usprd05 usprd06
3 WPARs are in D-Defined/T-Transition/B-Broken State
Code:
lpar-command | awk '
/^Name/ { next; }
/^---/ { next; }
{
state[$2] = state[$2] $1 " ";
if( $2 == "A" )
acount++;
else
others++;
}
END {
printf( "==== WPAR Status Check =====\n" );
printf( "==== %s ====\n", date );
printf( "**** WPAR state Active:\n\t%s\n", state["A"] );
printf( "\t%d WPAR state A-Active\n\n", acount );
printf( "**** WPAR state Defined/Transition/broken:\n\t%s %s %s\n", state["D"], state["T"], state["B"] );
printf( "\t%d WPARs are in D-Defined/T-Transition/B-Broken state\n", others );
}
' date="$(date)" |mail-command
hello all,
I'm invoking the program generate-report using backticks from my perl program and redirecting the output to the log file sge-stderr.log. But when i check the process using ps command it is spawing two processes where the below code is parent process and the program generate-report as... (2 Replies)
I'm writing a script using file descriptor 2 (std error) to send an email only if the command fails or errors out but the script always emails me irrepective of whether it fails or not. It will not email the /tmp/check.error file output if doesn't error out just the mail with the subject "Cannot... (3 Replies)
I currently have an expect script that issues the 'mail' command and sends an 'x' when it receives the & prompt from mail to quit.
The expect script is able to do stty rows 100 columns 200 < $spawn_out(slave,name) to set up the number of columns and rows.
I would like to get rid of the expect... (0 Replies)
hi,
i wat to get the output of a grep command in a file. but when i am trying out the same grep command in the unix prompt its working fine.. i am getting the output properly.. but when i am writing the same command inside my shell script , its just creating a new output file with no contents... (11 Replies)
Hi,
I'd like to redirect the STDOUT output from my script to a file and simultaneously display it at a console.
I've tried this command:
myscript.sh | tail -f
However, it doesn't end after the script finishes running
I've also tried this:
myscript.sh | tee ~/results.txt
But it writes... (3 Replies)
hi,
i have a html form which call a perl program, this perl program calls a shell script.
<html>
<head>
<title>demo</title>
</head>
<body>
<form name="frm1" action="/cgi-bin/perl_script.pl" method="post">
<input type="text" name="fname">
... (1 Reply)
Hi Guys,
I want to redirect the output of 3 scripts to a file and then mail the output of those three scripts.
I used below but it is not working:
OFILE=/home/home1/report1
echo "report1 details" > $OFILE
=/home/home1/1.sh > $OFILE
echo... (7 Replies)
I have the below script, but when i execute it is still printing to screen is there a way i can stop this and just print everything to the log file. Thank you.
#!/bin/bash
exec > >(tee "/var/log/ScriptLogs/called_from_incrontab.log") 2>&1
DIR="$1"
FILE="$2"
echo "STEP 1: Datafile... (5 Replies)
i have simple program that generate log file 1 line every sec, i need to do grep for specific record then redirect to another file.
#!/bin/bash
for i in `seq 1 20`;
do
echo $i
sleep 1
done
./test.sh |egrep "5|10|15"
5
10
15
r
./test.sh... (2 Replies)
Hi Experts,
Could you pls help with below query
I have written below script to capture disk utilization and then send the output on mail. But getting unformated output on mail
#!/bin/bash
echo "Hi Sur,">dfoutput.csv
printf '\n' >>dfoutput.csv
echo "Please find BAYSQUAR2 filesystem... (4 Replies)
Discussion started by: as7951
4 Replies
LEARN ABOUT SUSE
sievec
SIEVEC(1) General Commands Manual SIEVEC(1)NAME
sievec - Sieve script compiler for the Dovecot secure IMAP server
SYNOPSIS
sievec [-d] [-x "extension extension ..."] script-file [out-file]
DESCRIPTION
The sievec command is part of the Sieve implementation for the Dovecot secure IMAP server. Sieve (RFC 5228) is a simple and highly extensi-
ble language for filtering e-mail messages. It can be implemented for any type of mail access protocol, mail architecture and operating
system. The language cannot execute external programs and in its basic form it does not provide the means to cause infinite loops, making
it suitable for running securely on mail servers where mail users have no permission run arbitrary programs.
Using the sievec command, Sieve scripts can be compiled into a binary representation. The resulting binary can be used directly to process
e-mail messages during the delivery process. The delivery of mail messages and therefore also the execution of Sieve scripts is performed
by Dovecot's local delivery agent (LDA) called deliver. Usually, it is not necessary to compile the Sieve script manually using sievec,
because deliver will do this automatically if the binary is missing. However, in some cases deliver does not have permission to write the
compiled binary to disk, forcing it to recompile the script every time it is executed. Using the sievec tool, this can be performed manu-
ally by an authorized user to increase performance.
The sievec command accepts two arguments: the script-file argument specifies the script to be compiled and the out-file argument specifies
where the (binary) output is to be written. This Sieve implementation reconizes files with a .sieve extension as Sieve scripts and corre-
sponding files with a .svbin extension as the associated compiled binary. This means for example that Dovecot's deliver process will look
for a binary file 'dovecot.svbin' when it needs to execute 'dovecot.sieve'. Such filename is chosen automatically for the binary output
when the out-file argument is missing.
If the script-file argument is a directory, all files in that directory with a .sieve extension are compiled into a corresponding .svbin
binary file. The compilation is not halted upon errors; it attempts to compile as many scripts in the directory as possible. Note that the
-d option and the out-file argument are not allowed when the script-file argument is a directory.
The sievec command is also useful to verify Sieve scripts before using. Additionally, with the -d option it can output a textual (and thus
human-readable) dump of the generated Sieve code to the specified file. The output is then identical to what the sieved(1) command produces
for a stored binary file. This output is mainly useful to find bugs in the compiler that yield corrupt binaries.
OPTIONS -d Don't write the binary to out-file, but write a textual dump of the binary in stead. In this context, the out-file value '-' has
special meaning: it causes the the textual dump to be written to stdout. The out-file argument may also be omitted, which has the
same effect as '-'. The output is identical to what the sieved(1) command produces for a compiled Sieve binary file. Note that this
option is not allowed when the out-file argument is a directory.
-x "extension extension ..."
Set the available extensions. The parameter is a space-separated list of the active extensions. By prepending the extension identi-
fiers with + or -, extensions can be included or excluded relative to the default set of extensions. If no extensions have a + or -
prefix, only those extensions that are explicitly listed will be enabled. Unknown extensions are ignored and a warning is produced.
By default, all supported extensions are available, except for deprecated extensions or those that are still under development.
For example -x "+imapflags -enotify" will enable the deprecated imapflags extension along with all extensions that are available by
default, except for the enotify extension.
AUTHOR
The Sieve implementation for Dovecot was written by Stephan Bosch <stephan@rename-it.nl>.
Dovecot was written by Timo Sirainen <tss@iki.fi>.
SEE ALSO sieved(1), sieve-test(1)
4 July 2009 SIEVEC(1)