Skip to content
Advertisement

cron-job linux apache ssl

I have a server installed with apache2 and drupal 6. In my server, I have installed a module which need to use cron. I have a SSL certificate installed too.

In my crontab y have this configuration:

* * * * * wget -O --q -t 1 http://domain:8280/folder/cron.php
* * * * * wget --no-check-certificate -O --q -t 1 https://domain/folder/cron.php

My server work but if I write this configuration in my sites-enabled/000-default:

redirect permanent / https://domain/

my module with cron stops working. This is my error in syslog:

grandchild #20349 failed with status 5

I need to redirect my traffic from http to https.

Advertisement

Answer

First, make sure your redirect directive in 000-default.conf is correct (see Apache wiki for details) and doesn’t interfere with configuration in .htaccess file, if there is any.

Then fix you crontab this way:

  1. Remove the first line, as you don’t need plain http anymore
  2. Change the second line for this:

    wget –no-check-certificate -O /dev/null –quiet -t 1 https://domain/folder/cron.php

wget‘s option -O requires a path to a file, so either specify it, or just redirect to /dev/null. Also, in some versions of wget option -q considered ambiguous, so it’s better to use --quiet to supress output instead.

Sometimes you may want to put your rather longish command into a shell script file, make it executable (chmod +x your-script.sh) and make sure it does exactly what you want it to do when run under the webserver’s user (sudo -u www-data /path/to/your-script.sh and check if it did the trick to your drupal module). Then use the path to your script in the crontab. That will ensure that everything works like a charm and will keep your crontab neat and valid.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement