homepage Welcome to WebmasterWorld Guest from 50.17.107.233
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Visit PubCon.com
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




msg:1508726
 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




msg:1508727
 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




msg:1508728
 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




msg:1508729
 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




msg:1508730
 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




msg:1508731
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved