Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linux Script or Cronjob 1

Status
Not open for further replies.

chieftan

MIS
Dec 18, 2002
292
GB
Hi,

I want to run an automated job, once per week that search's log files under /var/log/radius and then the WLC IP Address (Directory) for logons within that week period.

What is the easiest way to do this? Cronjob? Shell script? perl script? Also, as I am not a scripter, does anyone have any ideas how to do this?

Thanks
 

Yes

Shell script? perl script?
One of those or maybe Python.

search's log files

that searches log files, or does something with log files belonging to search?



Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
[tt]cron[/tt] is the facility to run something for you at some time. This is the part that will run your automated job once per week. Google "crontab" for more information.

[tt]cron[/tt] will need something to run. This is where you need to either have a single command to do what you want, or write a script. You will need to write something that will do what you want one time. [tt]cron[/tt] will take care of running it for you once a week.

Your script can be written in just about anything. I recommend using something you either know, or can learn quickly. If you can do what you want to do in a set of command line commands, then just putting those commands into a shell script is probably the easiest. That will automate what you can do at the keyboard.

I can't suggest much more because I don't understand what you're trying to do.

 
Sorry, probably didn't word it correctly.

Accounting information will be held within the /var/log/radius/radacct directory for attributes from authenticating clients.

I would like to be able to search those log files, automatically, and show anyone logged on within a 7 day timeframe (run the script once per week). So, it would need to search the log files for authentication accounting for the last 7 days and output the result to a text file or other readable file.

So,I can run a cronjob showing the actual dates of the full log file, but I need to search within those logfiles. Would I use a grep command somehow?

Thanks
 
Yep, you write a script that uses grep or egrep to extract the data that you require and write (redirect >|>>) it to a text file. You could also pipe through a sort to put the results in some kind of order should you so wish.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
A script is just a sequence of shell commands that will be executed. You need to make the script executable by running the chmod +x SCRIPTNAME command. As far as jobs scheduling goes, take a look here: link
 
Can you post a log excerpt showing the data you'll be searching for?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top