Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How do I add a MYSQL query to the nightly cron?

Quote Reply
How do I add a MYSQL query to the nightly cron?
My cron looks like this:

30 23 * * * /home3/ling/www/l/admin/nph-verify.cgi --check_all
15 20 * * * /home3/ling/www/l/admin/nph-build.cgi --changed

I'd like to precede the nph-verify.cgi processing with a MYSQL Query. How do I modify the script to do my query? Or how do I create a new script with my query and put it into a new cron?
Quote Reply
Re: [dwh] How do I add a MYSQL query to the nightly cron? In reply to
In Reply To:
Or how do I create a new script with my query and put it into a new cron?


you would need to make a new script and run that through your cron.

how to do the script? you could copy one of the existing scripts and hack the code to do what you want...

r
Quote Reply
Re: [ryel01] How do I add a MYSQL query to the nightly cron? In reply to
I'd love to but these Perl modules confuse the hell out of me. I don't see a single place with a straightforward MYSQL query that I can copy.

I never "got" Object Oriented Programming and it reads like Chinese to me.
Quote Reply
Re: [dwh] How do I add a MYSQL query to the nightly cron? In reply to
What are you trying to do exactly? May be quite simple to code :)

I guess your best bet, as ryel suggested. Add in some code to do what you want, so that the commands are run just before the nph-verify script does anything.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] How do I add a MYSQL query to the nightly cron? In reply to
I just want this SQL

Code:
UPDATE Links SET URL=TRIM(TRAILING '/' FROM URL)


to be run right before nph-verify.cgi --check_all
Quote Reply
Re: [dwh] How do I add a MYSQL query to the nightly cron? In reply to
In that case, you should be able to get away with adding this just before the main subroutine call in nph-verify.cgi;

Code:
$DB->table('Links')->update({ URL => \"TRIM(TRAILING '/' FROM URL)" }) || die $GT::SQL::error;

Please be sure to do a backup of your tables though, just in case it doesn't have the desired effect.

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] How do I add a MYSQL query to the nightly cron? In reply to
Thank you. It worked like a charm :)

You might want to click on Check Duplicates from the table menu, then from SQL Monitor try this query and then Check Duplicates again. I found a lot of hidden dupes because of that trailing slash.
Quote Reply
Re: [dwh] How do I add a MYSQL query to the nightly cron? In reply to
Glad to hear it :)

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates