Getting cronjobs to work

Hello,

I'm a webmaster of a website. It currently still runs ELGG 2.x. We are moving to a new environment, where we use Direct Admin. The database and code are copied to the new environment, but I don't get the cron jobs to work. The site is located at elgg.mydomain.nl/elgg , and will stay there.

The old environment was quite confusing, but cronjobs seemed to be addressable like elgg.otherdomain.nl/minute

I tried several locations, files,... in the new environment, where it should be something like elgg.mydomain.nl/elgg ... But whatever I add or remove, the cron job does give messages like

... is a directory
... is a not a file
... is not executable
... you don't have the right permissions.

Our hosting provider can't figure out how to set these cron jobs too.

Suggestions are very welcome!

I know, I will have to bring Elgg to a much more current version too, getting the database to the relevant version. But first: get cronjobs working.

Thanks for reading and responding,

Ronald

  • Hi Ronald,

    you got the url almost right, it should be elgg.mydomain.nl/elgg/cron/minute etc..

    Have a look at http://learn.elgg.org/en/2.3/admin/cron.html for some more information.

  • I've never used the Direct Admin panel but for our apps running on Elgg 2, we use crontab with this configuration:

    * * * * * /usr/bin/lwp-request -m GET -d https://app.name/elgg/cron/minute/ &>/dev/null
    */5 * * * * /usr/bin/lwp-request -m GET -d https://app.name/elgg/cron/fiveminute/ &>/dev/null
    15,30,45,59 * * * * /usr/bin/lwp-request -m GET -d https://app.name/elgg/cron/fifteenmin/ &>/dev/null
    30,59 * * * * /usr/bin/lwp-request -m GET -d https://app.name/elgg/cron/halfhour/ &>/dev/null
    @hourly /usr/bin/lwp-request -m GET -d https://app.name/elgg/cron/hourly/ &>/dev/null
    @daily /usr/bin/lwp-request -m GET -d https://app.name/elgg/cron/daily/ &>/dev/null
    @weekly /usr/bin/lwp-request -m GET -d https://app.name/elgg/cron/weekly/ &>/dev/null
    @monthly /usr/bin/lwp-request -m GET -d https://app.name/elgg/cron/monthly/ &>/dev/null
    @yearly /usr/bin/lwp-request -m GET -d https://app.name/elgg/cron/yearly/ &>/dev/null

    Maybe you just need to create cron intervals and set the above command to get cron running.

    You can also use wget:

    /usr/bin/wget --output-document=/dev/null https://app.name/elgg/cron/minute/ >/dev/null 2>&1
    /usr/bin/wget --output-document=/dev/null https://app.name/elgg/cron/fiveminute/ >/dev/null 2>&1
    ...

    And even lynx:

    /usr/bin/lynx -source https://app.name/elgg/cron/minute/ &>/dev/null
    ...

    Learn more about Cron.

    Also, look at this plugin.

  • Thanks for your responses.

    I still don't get it to work...
    I found that I can get a PHP-file activated at
    /bin/sh: /home/<USERNAME>/domains/elgg.<OURDOMAIN>.nl/public_html/elgg/<MYPHPSCRIPT>.php
    I had to set permissions for that file, to refrain from getting 'Permission denied'

    However, when I put
    /bin/sh: /home/<USERNAME>/domains/elgg.<OURDOMAIN>.nl/public_html/elgg/cron/minute/
    or
    /bin/sh: /home/<USERNAME>/domains/elgg.<OURDOMAIN>.nl/public_html/elgg/cron/minute
    in a cron job, I get 'No such file or directory'.

    Do I have to set specific rights to a certain file? Do I have to run anything? There is no file nor directory 'cron' in my elgg-directory.

    The server I currently use is not yet available on the internet without redirecting in my hosts-file, but that should not prevent it from working with its own cron jobs, should it?

    Thanks for (more) help...

    Ronald

  • However, when I put
    /bin/sh: /home/<USERNAME>/domains/elgg.<OURDOMAIN>.nl/public_html/elgg/cron/minute/
    or
    /bin/sh: /home/<USERNAME>/domains/elgg.<OURDOMAIN>.nl/public_html/elgg/cron/minute
    in a cron job, I get 'No such file or directory'.

    You need to do a wget https://elgg.mydomain.nl/elgg/cron/minute

    This is not the same as executing a .php file. Please read the documentation carefully. Or read Nikolai's comment again that does the same as the documentation.

  • Thanks, Jerome Bakker.

    The cron job now gets activated every minute.

    However, the output (send in mail, while testing) says 'Scheme missing'. It does not seem to handle the expected function(s). Do you have any clue where I should look to solve this?

    Ronald