homepage Welcome to WebmasterWorld Guest from 54.167.174.90
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
perl scripts automatically run on the apache server
perl scripts automatically run on the apache server in linux
Ramesh

10+ Year Member



 
Msg#: 20 posted 9:52 am on Aug 30, 2002 (gmt 0)

I need the program in perl that it automatically takes the input from the log file and updates in mysql database. That is the log file data changes every seconds. while the data changes in the logfile, the script should take the data and put it into the database. That is the script is always running and watching in the server for the log file updates. How to do this in perl. Please help me to solve this.

Thanks.
S.Ramesh.

 

andreasfriedrich

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 20 posted 10:25 am on Aug 30, 2002 (gmt 0)

This is from recipe 8.5 in the Perl Cookbook:

Read until end of file. Sleep, clear the EOF flag, and read some more. Repeat until interrupted.

for (;;) { 
while (<FH>) { add to database }
sleep $SOMETIME;
seek (FH, 0, 1);
}

Ramesh

10+ Year Member



 
Msg#: 20 posted 12:21 pm on Aug 30, 2002 (gmt 0)

hello friend,

Thanks for your reply. But this code runs if we run the script in the konsole. But I need the script which automatically runs while the server starts run.

Thanks.
S.Ramesh.

andreasfriedrich

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 20 posted 12:36 pm on Aug 30, 2002 (gmt 0)

I might be wrong but how about adding the perl script to the init script that starts and stops your webserver?

Ramesh

10+ Year Member



 
Msg#: 20 posted 12:44 pm on Aug 30, 2002 (gmt 0)

You are not wrong. The script is working correctly.

We run this script by ourself in konsole. But my need is, " this program should be controlled by the server. If the server starts running, this program also need to run." That is, this program is controlled by the server.

Thanks!
S.Ramesh.

Duckula

10+ Year Member



 
Msg#: 20 posted 1:15 pm on Aug 30, 2002 (gmt 0)

That script varies depending on your distro. At Debian, for example, you'd add a line at the start) case of /etc/init.d/apache.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved