[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] [RaQ 3] Scripting problem
- Subject: Re: [cobalt-users] [RaQ 3] Scripting problem
- From: "Bob Coomes" <bcoomes@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed May 2 04:55:27 2001
- List-id: Mailing list for users to share thoughts on Cobalt products. <cobalt-users.list.cobalt.com>
>We need to be able to automatically "push" data from the central db into
>each client db at a predefined time each day, based upon data changes made
>within the central db, in the form of an automatic update. This would
>obviously need there to be an ASP script called and executed on the main db
>site at a predefined time each and every day, ie on a schedule.
>
>Any help would be greatly appreciated.
>TIA
>
>Regards
>
>Si Watts
>SiWIS
>http://www.siwis.com
I know what you're going through. I'm new to all this linux & perl stuff
myself. Since I do know ASP, I built an ASP page for my functionaility
(queries a MySQL db each night and performs certain operations based upon
the result of the query).
This is how I accomplished the task:
1-Made my ASP page
2-Placed this page, we'll call it "mypage.asp", into a password protected
directory within the website
3-Logged into my server via SSH
4-Logged in as root (su)
5-Changed to the /etc directory
6-Created a file that will run my asp page each day, lets call it
"schedule". This file contained only 1 line as follows:
15 1 * * * wget -q --spider --http-user username_here --http-passwd
pass_here http://www.yourdomain.com/path/mypage.asp > /dev/null 2>&1
7-executed the following:
crontab -e schedule
Line 6 specifies the parameters for your scheduling. As typed above, it has
the following meanings:
"15 1 * * *" is in the form of minute, hour, day, month, day of week
"wget" a utility to retreive files via http
"-q" quiet mode, no output
"--spider" I read in the archives that this basically does the same thing
as "-q" and should be included. Not sure why, but it works for my app.
"-http-user username_here " when prompted for a username to get into the
password protected directory, the wget utility will respond with
"username_here"
"-http-passwd pass_here" when prompted for a password to get into the
password protected directory, the wget utility will respond with "pass_here"
The http:... should be obvious
"> /dev/null 2>&1" ensures any output returned from your script is deleted
Line 7 takes your file (schedule) and enters it into the cron utility so it
will be executed based on the frequency you specified.
You don't have to place your asp page into a password protected directory, I
did because I don't want anyone accidentaly executing mine. Some of my
explanations may not be the greatest, and there may be an easier way of
doing this, but when you lack experience you have to do what you can.
bob c.