Hi guys if for every command you issued successfully where to be logged from a script and them sent an email to the admistrator how could i stop that so that i wouldnt have to delete admin mail all the time. I would only want to produce output if there was an error.
Bash scripts do not normally cause anything to be logged anywhere. Perhaps you can describe the scenario and environment where this is happening in a bit more detail.
On a hunch, I'm guessing you might be talking about a cron job or similar which generates output which then gets sent to the administrator. In general terms, you can suppress regular output by redirecting it to /dev/null, like so:
If verbosecommand is correctly implemented, error messages will not be suppressed by this redirection (this is why we have separate "standard output" and "standard error"; the above discards only the "standard output").
yes i am talking about a cron job so if this script where to run as a cron job process and it would send mail to the administrator. I would only want it to send error messages to the log file. Would the above work ok?
That's the idea, yes. To be on the safe side, perhaps you can start by redirecting to a real file, instead of /dev/null, and check after the job completes that the file doesn't contain useful information. If the job is a shell script (or, for that matter, a binary that you have the source code for), it might be a useful exercise to change it so it doesn't emit spurious output, in keeping with a great Unix design principle. Maybe there could be a separate --quiet option for this.
In order to be able to test this without waiting for cron to kick in, and also to keep your crontab simple, you might want to create a wrapper script which sets up the redirections etc, and invoke that from your crontab instead of the real thing.
When I do "set -n" or "set -o noexec" the shell doesn't do what it sould.
Infact if I check:
$: set -o
....
noexec off
....
f
...instead I can set normally the other option.
Who Knows what could be up? (2 Replies)
When unlocking a Linux server's console there's no event indicating successful logging
Is there a way I can fix this ?
I have the following in my rsyslog.conf
auth.info /var/log/secure
authpriv.info /var/log/secure (1 Reply)
A Gbytes long log
/var/log/apache2/access_log
causes my question: How to stop my IP logging (just because of frequent AJAX/setTimeout).
As config:
SetEnvIf Remote_Addr "ip\.ip\.ip\.ip" dontlog
CustomLog /var/log/apache2/access_log common env=!dontlog
In
/etc/apache2/httpd.conf ... (0 Replies)
I am trying to write a script that can be called by other scripts to print output to a log. I also want to be able to rotate the log file for this script with a max of 5 logs files. This is what I have so far:
#/bin/ksh
. /taipso75/scripts/IPSM_run_profile.sh*
log=${IPSM_HOME}/log
(
echo... (1 Reply)
Hi everyone,
I have this problem with a script I'm writting. I want to execute a code running in the background several times through a script. I am writting it like that
parent_script
for a in 1 2 3 4 5
do
exec test -n $a
done
What I want to do is when parent_script is killed,... (0 Replies)
Hi All,
Sorry if it is a duplicate post. I have not got any reference about this anywhere.
I looked at the posts described in SSH - Passing Unix login passwords through shell scripts - Linux / UNIX Forum and it helped me till the point to connect to the host and executing the basic commands.... (3 Replies)
Hi, I have googled for quite some time and couldn't able to get what exactly I am looking for.. My query is "how to stop a shell script which is running inside a remote server, using a script"??? can any one give some suggestions to sort this out. (1 Reply)
Hello
One of our applications initiates an ftp logon to itself twice every second ...(to check some files or something im not sure) but every time it does this it logs an entry into the wtmpx database, this file is now getting absolutely huge and whilst I know that I could implement some type of... (1 Reply)
Hi there
I get the following message im my messages file 2 or 3 times a second
Dec 4 11:44:18 my-box in.timed: connect from localhost
I would like to stop in.timed from logging to syslog altogether as this message is filling up my disk.
I dont want to stop daemon.info altogether... (0 Replies)
Hi,
I am running a script where i need to run another command in a particular folder which I do not have access so I need
to login as su to that folder and run that script...what are the options I need so that I
can skip interactive mode ..here is what I tried..
#! /usr/bin/sh... (2 Replies)