All posts tagged: cron

Certbot: auto-renew LetsEncrypt certificate on cron

Leave a comment
Howtos / System Administration

Certificates renewal can be difficult to automate leading to errors that will mark the website as “Insecure”. Here’s how to automate certificate renewal on CentOS 7 with nginx as webserver: And then add to the crontab these lines pressing A to edit: Every day at 02.37 the certificate will be asked for renewal. Two minutes later nginx will be restarted. After you’ve typed these lines, type: :wq To write and quit. You’ll get this message: […]

Clear Varnish cache via PHP: a Drupal 7 proof of concept

Leave a comment
Coding / Drupal

Using Varnish as reverse proxy or proxy is an useful approach to reduce the load of webservers like Apache. In Drupal 7 I’ve to clear the varnish cache of a specific domain when Drupal caches are globally cleared. Drupal has the right hook invoked when cache are cleared: Now this piece of code simply adds the current domain to a ASCII text file on /var/www/varnishdomains2cleardir/varnishdomains2clear. Preparing the file to the write On CentOS you have […]

Cron cannot run on Drupal: the drupal_goto() case

Leave a comment

Sometimes you want to redirect a page to another on drupal. You can do this using a simple function called drupal_goto(). On few sites I’ve enabled the PHP filter module and then created a new page with PHP code input format with drupal_goto(‘node/2’) to redirect the current page to a specified node. Bad idea. I’ve noticed that, after this change, cron.php operations failed, if you have Search module enabled. On cron new contents are indexed […]