LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-04-2008, 07:50 AM   #1
prakash.akumalla
Member
 
Registered: Jun 2008
Location: India
Posts: 109

Rep: Reputation: 15
Question what to do to run a script like this


Hai,

In my system I have a syslog and it stores all the log data in /var/log/messages. If I try to access the root by entering wrong password, a log message will be generated there. Now, my doubt is that can I run a shell script when this(wrong password) type of message is generated automatically.
 
Old 07-04-2008, 08:13 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
You can log a message in your script using the logger command.

Code:
cat >logtest
logger -t $0 'This is a test message'
jschiwal@hpamd64:~> chmod +x logtest
jschiwal@hpamd64:~> ./logtest
This simple one-line script produced this message when run:
Code:
Jul  4 07:10:41 hpamd64 ./logtest: This is a test message
 
Old 07-04-2008, 08:20 AM   #3
prakash.akumalla
Member
 
Registered: Jun 2008
Location: India
Posts: 109

Original Poster
Rep: Reputation: 15
hi,
I think you did not get me. What actually I mean is if i get one particular message in my logs then that message should automatically run a script. I don't mean that a script should generate a log message when run.
 
Old 07-04-2008, 08:34 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531Reputation: 3531
Run a logfile parser that can perform tasks based on rules like SEC.
 
Old 07-04-2008, 03:02 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
If what you want to do is tally failed logins and lockout a user name based on a certain number of consecutive failed logins, look at the man pages for pam_tally, faillog and login.defs.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash Script Help - Trying to create a variable inside script when run. webaccounts Linux - Newbie 1 06-09-2008 03:40 PM
Is a script, run at boot time from init.d, run with root authority? tmbrwolf53 Linux - Server 2 03-31-2007 09:15 PM
how to run a shell script in the perl script sharad Linux - General 1 05-24-2006 04:23 AM
Shell script to run pl/sql script. colly Linux - General 1 09-09-2004 07:49 AM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 10:34 AM


All times are GMT -5. The time now is 02:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration