Solved

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

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

Use Filtering Commands to Process Files in Linux

Learn how to manipulate data with the help of various filtering commands such as `cat`, `fmt`, `pr`, and others in Linux.

Question has a verified solution.

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

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…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

627 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