Sponsored Content
Full Discussion: Need help with script.
Top Forums Shell Programming and Scripting Need help with script. Post 302350273 by taekwondo on Thursday 3rd of September 2009 09:56:35 AM
Old 09-03-2009
I'm getting there and I really appreciate everyone's help. Thank you all.

I tried Av's and Dan's code and they both worked. The last thing I tried was dan's awk statement, which produced this after a bit of tweaking.

**Unmatched Entries** unix_chkpwd[8788]: password check failed for user (henry)
**Unmatched Entries** unix_chkpwd[13474]: password check failed for user (henry)
**Unmatched Entries** unix_chkpwd[13474]: password check failed for user (henry)
**Unmatched Entries** unix_chkpwd[22256]: password check failed for user (henry)
**Unmatched Entries** unix_chkpwd[8788]: password check failed for user (henry)
**Unmatched Entries** unix_chkpwd[13474]: password check failed for user (henry)
**Unmatched Entries** unix_chkpwd[13474]: password check failed for user (henry)
**Unmatched Entries** unix_chkpwd[22256]: password check failed for user (henry)

which is very good. It seems like its looking for unmatched entries, I'm sure there's an easy way of looking for other items (multiple items) such as A or B or C. In my case it would be unmatched entries or Illegal users from? Thanks again, this has been great for me, I am finally learning how to script. Smilie

---------- Post updated at 09:56 AM ---------- Previous update was at 09:55 AM ----------

I am sorry, can you please explain this further?

You might pass the log file in as an argument - so that it's not always checking the /var/spool/mail directory.

I don't know how to pass the log file in as an argument.

Thanks.

Quote:
Originally Posted by avronius
I haven't been able to figure out how to insert a variable into the search field, or I'd provide that example... Here's something that will return the line that matches your search string AND the line that follows immediately afterward.

Code:
#!/bin/sh

/usr/xpg4/bin/awk '/Illegal users/{_=2}_&&_--' /var/spool/mail/*
/usr/xpg4/bin/awk '/Unmatched Entries/{_=2}_&&_--' /var/spool/mail/*
/usr/xpg4/bin/awk '/Authentication Failures/{_=2}_&&_--' /var/spool/mail/*
/usr/xpg4/bin/awk '/Invalid Users/{_=2}_&&_--' /var/spool/mail/*

You might pass the log file in as an argument - so that it's not always checking the /var/spool/mail directory.

edit ----------
that should be {_=1}
 

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

create a shell script that calls another script and and an awk script

Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table... (0 Replies)
Discussion started by: magikminox
0 Replies

2. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

3. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below. #masterscript.sh ./callingscript.sh echo $fileExist #callingscript.sh echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

4. Shell Programming and Scripting

Shell script works fine as a standalone script but not as part of a bigger script

Hello all, I am facing a weird issue while executing a code below - #!/bin/bash cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset sh UKBA_publish.sh UKBA 28082015 3 if then echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
Discussion started by: ektubbe
2 Replies

5. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies
TOMOYO-AUDITD(8)					  System Administration Utilities					  TOMOYO-AUDITD(8)

NAME
tomoyo-auditd - access request log recording daemon for TOMOYO Linux SYNOPSIS
tomoyo-auditd tomoyo-auditd [remote_ip:remote_port] DESCRIPTION
This program reads access request logs from the kernel and writes to the locations specified in the configuration file. By running this program at startup, access request logs for either all domains or selected domains can be stored. The format of the stored logs is similar to domain policy, so they can be used to help develop policy. Configure this daemon in /etc/tomoyo/tools/auditd.conf. If an access request matches a rule, it will be written to the specified log file. This can be used to split access request logs into multiple files. Only the first matching rule is used, so any single access request log will be written to a maximum of one output file. If an access request log does not match any rules, it will be discarded. Start this program from an appropriate stage during startup (e.g. /etc/rc.local). OPTIONS
remote_ip:remote_port Retrieve access request logs from a remote system via an agent, connecting to the specified IP address and port number. BUGS
If you find any bugs, send an email to <tomoyo-users-en@lists.sourceforge.jp>. AUTHORS
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Main author. Jamie Nguyen <jamie@tomoyolinux.co.uk> Documentation and website. SEE ALSO
tomoyo-editpolicy-agent(8) See <http://tomoyo.sourceforge.jp> for more information. tomoyo-tools 2.5.0 2012-04-14 TOMOYO-AUDITD(8)
All times are GMT -4. The time now is 01:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy