Solved

Setup crons to run consecutively

Posted on 2014-11-09
4
153 Views
Last Modified: 2014-11-09
Hello,

I have 3 crons that need to run minutes apart and they need to start every 45 minutes.

Currently I am running them every hour and that is easy because I can set the times, but I need to up the frequency and I a not sure how to do that.

0      */1      *      *      *      wget -O /dev/null http://domain.com/cl/parse.php?action=list_page
10      */1      *      *      *      wget -O /dev/null http://domain.com/cl/parse.php?action=parse_page
15      */1      *      *      *      wget -O /dev/null http://domain.com/cl/parse.php?action=download_image

It would be ideal if I could make them all run in the same cron so once one was finished it triggered the other... but I don't think that is possible.

Matt
0
Comment
Question by:movieprodw
4 Comments
 
LVL 15

Accepted Solution

by:
Haris Djulic earned 500 total points
ID: 40431555
Can you make the batch script to this job and  and then call it every 45 minutes?

You create the script like this :

#!/bin/bash
wget -O /dev/null http://domain.com/cl/parse.php?action=list_page
sleep 5m
wget -O /dev/null http://domain.com/cl/parse.php?action=parse_page
sleep 5m
wget -O /dev/null http://domain.com/cl/parse.php?action=parse_page

Open in new window


You save this script to /home/your_user/wget_script.sh and your cron file will be

45 */1 * * *  /home/your_user/wget_script.sh

Open in new window

0
 
LVL 23

Expert Comment

by:savone
ID: 40431556
To run a cronjob every 45 minutes you can use:

*/45 * * * * wget -O /dev/null http://domain.com/cl/parse.php?action=list_page
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40431624
Make one script that calls the others in sequence.
0
 
LVL 1

Author Closing Comment

by:movieprodw
ID: 40431638
Thanks!

I think this will work.

The issue is that the scripts take a long time and will timeout if I run them all together.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
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 several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

770 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