[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

crond running mulitiple copies

Posted on 2006-10-20
7
Medium Priority
?
301 Views
Last Modified: 2013-12-16
I have crontab running a wget every night at 8pm, with the following command:

* 20 * * * wget http://www.domain.com/admin/dbcleanup.php > /dev/null 2>&1

Or at least that's what I expect that it does....

Well every night I look at the machine around 8:30 and there's 15 or so copies of the above command running.  

FYI, the scriipt does take about 90 seconds to complete.

Am I invoking the script incorrectly in crontab?
thanks
0
Comment
Question by:bennybutler
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 17778355
Hi bennybutler,

The cron is correct .... multiple instances you see are those of threads spawned by wget.

Cheers!
sunnycoder
0
 
LVL 1

Author Comment

by:bennybutler
ID: 17778374
Ouch! All this time...

Strange, i never noticed it doing that before when I tested from the command line.

So, would curl --get http://www.dailycommunicator.com/admin/dbcleanup.php > /dev/null 2>&1

Get the job done without spawning?    I just need one copy to fire up, and run for a max of 2 minutes.  The way it's working now, with so many copies running, it takes hours for them all to finish.

Thanks ,
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 17778390
>FYI, the scriipt does take about 90 seconds to complete
>I just need one copy to fire up, and run for a max of 2 minutes.
Seems like current solution fits your needs!!!

Number of copies should nto matter here. They would actually be making your script run faster. Network and disc access are typically lot more slower as compared to CPU processing power ... If you use a single threaded application, it would block for completion of each network and disc access. As of now, if one thread blocks for a resource, another thread can continue execution. Also all threads can download in parallel rather than one downloading at a time.

Cheers!
sunnycoder
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:bennybutler
ID: 17778423
Normally yes, but I failed to mention, the objective here is NOT to get the output of the dbcleanup.php.  The output is simply 'complete'

I just need the script triggered.  The script runs a number of mysql delete functions, such as

delete from log where date < date_sub(curdate, interval 30 day)

Yeah, that's wrong, but you get the idea.  The problem I'm having is I end up with 10-15 of those running, all competing to run server.  Mysql locks the table for each delete, so they all line up and try to run one after another, and the longer it runs, the more copies start up...

I just need a single instant to run, and no more. So should I stick with the wget, and some flag, or switch to the curl.  Hell, even ab would do it, I just need to make sure it's only kicked off once a night.
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 500 total points
ID: 17778455
wget ahs no switch to make it run in non-interactive mode and I am not sure how curl would handle it .. Initial search shows that curl implementation uses threads too.

If you need a single access, why not use a non-interactive browser instead?

Something like
http://www.w3.org/LineMode/User/CommandLine.html

www -n  http://www.dailycommunicator.com/admin/dbcleanup.php > /dev/null 2>&1
0
 
LVL 1

Author Comment

by:bennybutler
ID: 17778470
I'm going to try my hand with curl first.  i know it's much more 'integration friendly' as I've used it to process credit cards with authorize.net.  I think if it's default tendency was to spawn copies of itself, when I'm charging a credit card' then I'd know it already.

I am interested in that command line browser though, I've never seen that one.

Thanks for the help!
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 17778486
ooops
> wget ahs no switch to make it run in non-interactive mode an
should have been
 wget has no switch to make it run as a single thread ...

Thanks :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question