Solved

How can I have a bash script create a cron job that runs every 15 minutes?

Posted on 2008-06-10
2
604 Views
Last Modified: 2013-12-16
I want to have a bash script add a cron job that runs a php script every 15 minutes.
I know how to do it using:
export VISUAL=emacs
crontab -e
and then edit it manually.
But how can I automate that in a script?

Also on a sidenote this is the example crontab that the app I am trying to run reccomends:
0,15,30,45 * * * * /usr/bin/php /etc/php.ini /etc/php.d /usr/share/php \ /var/www/html/trellis/core/global/interfaces/event_runner.php

Some of these, like php.ini appear to be config files. Why would any app need config files in a cron job?  Can they even be executed?  That seems awfully confusing right now.
0
Comment
Question by:tate1615
2 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 250 total points
ID: 21756890
Generically speaking, the way to script adding cronjobs is:

crontab -l >/tmp/crontab
echo "0,15,30,45 * * * * /some/command" >>/tmp/crontab
crontab /tmp/crontab

Open in new window

0
 

Author Closing Comment

by:tate1615
ID: 31466027
Thank you very much for your help.  It was very fast, clear, and correct. I appreciate it!
Also what do you make of the second half of the posted question?
Does that make any sense to you?  Why would anyone's lamp web app need a crontab that runs php.ini?  What do you make of it?
0

Featured Post

Independent Software Vendors: 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

Developer tools in browsers have been around for a while, yet they are still heavily underused by developers. Developers still fix html or CSS then refresh page to see effect, or they put alert or debugger in JavaScript and then try again and again …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

756 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