Menu

crontabSetup

Michael Cummings

CrontabSetup

Quick guide to setting up Yapeal as a crontab job.

Introduction

After you've finished testing it manually from the command-line the
preferred way to run Yapeal on a Linux (Unix) LAMP platforms is as a
crontab job. Since many people aren't that familiar with using PHP in a
crontab here's an example of how to do it.

From a command line/ terminal window:

  • Make sure Yapeal is executable with
    chmod 0755 /path/to/yapeal/yapeal.php
  • Open your crontab file for editing by using crontab -e. This will
    open a copy of it in your default editor.
  • Add the line from below that most closely matches your system.
  • Save your changes and exit the editor and your new crontab will be
    installed.
  • See if Yapeal is running by checking cache files, log files, or what
    I find the easiest is to check the utilCachedUntil table from
    database and see if the dates for active APIs are being updated.

It often takes a couple minutes for the new crontab to start running and
can be up to 15 minutes on some systems so you'll want to wait at least
5 minutes and maybe as long as 20 minutes before you decide that the
crontab is not working.

OpenSuSE

The follow line is from an OpenSuSE 10.3 system but should work on most
newer Linux systems.

* * * * * /path/to/yapeal/yapeal.php

Change /path/to/yapeal/ to where you installed it. As long as the
command-line version of PHP is install and in your path the above should
work.

Alternate crontab

If for some reason PHP isn't in your path or the system defaults to the
wrong version of PHP for CLI this one should work for you.

* * * * * /full/path/to/php/php -f /path/to/yapeal/yapeal.php

Change /full/path/to/php/ to where you installed Yapeal

Different yapeal.ini

WARNING: This should only be used if you have a special need to run
multiple copies of the same Yapeal install with several different
yapeal.ini. You should change the path in inc/common_paths.php to
move the config/ directory after installing Yapeal if you don't need
to run multiple concurrent copies.

To run Yapeal with a yapeal.ini from an alternate location try
something like this.

* * * * * /path/to/yapeal/yapeal.php -c /path/to/my/yapeal.ini

Additional things to do

You'll probably notice that with Yapeal running as a crontab job you'll
start receiving lots of mail messages from crontab. You can usually stop
them by adding the follow line before the one you added in your crontab
above.

MAILTO=''

if that doesn't work try telling crontab to send the output to
/dev/null

* * * * * /path/to/yapeal/yapeal.php > /dev/null

or

* * * * * /full/path/to/php/php -f /path/to/yapeal/yapeal.php > /dev/null

Additional notes

Since Yapeal isn't made to interact with a web browser directly it
doesn't have to be installed below your web server's Doc-root and it
would be better for security if it wasn't. Most of Yapeal has been
somewhat secured with .htaccess files and other security features but
by located it somewhere Internet users can't get to it will always be
much more secure.

If you can't install Yapeal outside of your webserver's Doc-root you
should definitely move at least the config/ directory as it contains
your yapeal.ini which has sensitive information like your database
user name and password that you don't want people to be able to look at
in their browsers.

Other directories that some people find sensitive are the log/ and
cache/ directories. They can be moved as well by editing
inc/common_paths.php


Comment by gilgam...@gmail.com, May 8, 2009

Some people may need to use

/full/path/to/php/php5-cli -f /path/to/yapeal/yapeal.php

in their cron file dependent on their hosting provider.


Comment by spikaner...@yahoo.de, Nov 26,
2011

And other People (Debian squeeze with PHP 5.3.3-7+squeeze3 with
Suhosin-Patch (cli) ) need an seperated .sh file

usr/local/bin/yapeal.sh (rights 755)

in the file:

1
2
#!/bin/sh
/usr/bin/php -f /path/to/yapeal/yapeal.php

and crontab

*/1 * * * * /usr/local/bin/yapeal.sh

to get the script to work.


Related

Wiki: MakeYapealAutomatic
Wiki: StarterGuide

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.