Re: Triggering script from cron or web client

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Fri, Jul 8, 2011 at 5:58 PM, Kenneth Porter <shiva@xxxxxxxxxxxxxxx> wrote:
> I have a Bash script, currently run a couple times an hour from cron, that
> pulls data from an old Windows DB by rsync, converts it to SQL, and injects
> it into a MySQL DB for display in a LAMP-based app. (Make and Perl are also
> involved to minimize the number of tables touched and to clean up the SQL
> generated by Pxlib.)
>
> I'd like to add the ability to refresh the data immediately from the web
> app, but I don't want it to trample on the periodic script and corrupt the
> data.
>
> I figure the ideal way to do this is to run the script in a loop in its own
> process, waiting on a semaphore that times out at the refresh period, and
> poke the semaphore from the web app to have it run before the next periodic
> cycle.
>
> Are there existing frameworks to wrap this kind of thing in? Something that
> handles starting the loop at server startup, shutting it down at server
> halt, and handles the IPC between the web server and the service script.


Web page creates a temp file saying "update", then cron job runs once
a minute looking for that file, kicks off update script, then deletes
temp file.  If you don't want to wait a full minute you could use
'incron' to monitor the temp directory and kick the update right away.
 Seems better than having something in a loop constantly checking.


-☙ Brian Mathis ❧-
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux