Solved

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

Posted on 2008-06-10
2
606 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
[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
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Check for Linux process in script 7 88
NFS v4 7 76
How ldap located a Domain controller? 22 78
Linux Server mapping drive using SSH key 9 53
Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
If I have to fix slow responding website my first thoughts are server side optimizations: the database may not be optimized or caching is not enabled, or things like that. We often overlook another major part of our web application: the client. We o…
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.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

739 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