Script for Logfile Inserting into the Database


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script for Logfile Inserting into the Database
# 1  
Old 04-21-2011
Script for Logfile Inserting into the Database

Here's the problem.

I have a shell script running for every one minute as cronjob that outputs to a log file. I want to be able to take the data from the log file and insert it into a mysql database. The script needs to run at a set period of time and remove the log file data once the insert is complete, without a user having to do anything.

Thanks in Advance in making the Impossible things Possible by your valuable help!!!!!!!!!
# 2  
Old 04-21-2011
You can do the job similar way using cronjob.
Set up the second script to run as cronjob as per the required time interval and do the job of inserting the data into the sql database through this script.

what is that you need help for?

regards,
Ahamed
# 3  
Old 04-21-2011
can you just post me up the way u do it as cronjob!!!
# 4  
Old 04-21-2011
crontab -e #this will open up the crontab file where you need to insert the file which needs to be run at specific time interval

Code:
15 * * * * /where/ever/your/script/is

The above script is sceduled to run every 15th minute of an hour. Change it as per your requirement.
man crontab for more details.

regards,
Ahamed
# 5  
Old 04-21-2011
actually this was done dude the thing was like i want to get the information inside a logfile which should be inserted into a mysql database at a particular table
# 6  
Old 04-21-2011
what is stopping you from getting the data inside the log?
Can you paste the code you have tried till now?

regards,
Ahamed
# 7  
Old 04-21-2011
i want to know the process in steps....as i'm new in doing this task
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Inserting values to database

hi , I'm new to Unix shell scripting. I need help to insert read csv which has two columns -emp no and logged date. csv file is a large file so i want to keep the insertion query in a separate .sql file. csv file looks this: empno | loggeddate ___________________ 5666 ,... (5 Replies)
Discussion started by: preema
5 Replies

2. Shell Programming and Scripting

Inserting script variables into database

I have a script working out ink percentages #!/bin/bash currentcyan=$'iso.3.6.1.2.1.43.11.1.1.9.1.1 = INTEGER: 990' currentmagenta=$'iso.3.6.1.2.1.43.11.1.1.9.1.2 = INTEGER: 972' currentyellow=$'iso.3.6.1.2.1.43.11.1.1.9.1.3 = INTEGER: 972' currentblack=$'iso.3.6.1.2.1.43.11.1.1.9.1.4 =... (1 Reply)
Discussion started by: leshy93
1 Replies

3. Shell Programming and Scripting

Inserting values into database from an excel

Hi, I have a requirement where I have an excel sheet with the below values COL1 COL2 COL3 Germany URGENT NORMAL I want to cut the values of this excel in such a way that I get the values and pass it to an insert statement update tbfin set... (2 Replies)
Discussion started by: venkidhadha
2 Replies

4. Shell Programming and Scripting

Logfile monitoring with logfile replacement

Bonjour, I've wrote a script to monitor a logfile in realtime. It is working almost perfeclty except for two things. The script use the following technique : tail -fn0 $logfile | \ while read line ; do ... some stuff done First one, I'd like a way to end the monitoring script if a... (3 Replies)
Discussion started by: Warluck
3 Replies

5. Shell Programming and Scripting

on manual script need to add logfile

hi all, 1.I am new to linux shell scripting. 2.i had an rman.sh script which will take backup all database using CATALOG DATABASE. 3.While executing that script my catalog DB gets shutdown. 4.The rman.sh script are executed manually. 5.so i need log for rman.sh .And also it is very useful... (1 Reply)
Discussion started by: jp_linux
1 Replies

6. Shell Programming and Scripting

Logfile monitor script

Hi, I'm trying to write a logfile monitor script that reads the logfile and then emails out once there is an error with SQL in. Here is my attempt below which does not work. I'm not much of a scripter as you can probably see but some pointers in the right direction would be much appreciated. ... (3 Replies)
Discussion started by: elmesy
3 Replies

7. Shell Programming and Scripting

Logfile rotation script.

I'm trying to find or create a Perl script that: Checks for and creates these files: notes notes.1 notes.2 notes.3 notes.4 The first represents the current log file and the others are older versions. Each time the script runs it would check for the existence of notes.3 and, if it exists,... (3 Replies)
Discussion started by: HardyV2
3 Replies

8. Shell Programming and Scripting

Attaching a logfile to the Script

Hello guys. I've recently written a basic utilities script just for home use. and i want to attach a logfile to it that will record all the commands that where executed in that script. Then just so i can add the d%b%y% and make each logfile unique and i can look back in each logfile to see what i... (9 Replies)
Discussion started by: matt02
9 Replies

9. Shell Programming and Scripting

Script to manipulate logfile text

Hi guys, I was wandering if a Shell guru could give me some advice on tackling a problem. I have used a mixture of grep, cut and awk to get data from a log file in the following format: 14/11/08 10:39: Checking currenly : Enabled 14/11/08 10:39: Records allocated : 221... (11 Replies)
Discussion started by: rosspaddock
11 Replies

10. Shell Programming and Scripting

perl script to filter logfile

i was wondering if anyone can help me, how could i write in perl a a script that would look through a log file and print onscreen the contents of the log file excluding lines that contain '192.168.1.' and entries that contain directory paths that arent in the directory /usr/local/httpd/htdocs/ i... (4 Replies)
Discussion started by: norsk hedensk
4 Replies
Login or Register to Ask a Question