How do you run Drupal's
drush cron jobs when your server has a newer PHP version installed from Software Collections?
The server is running Scientific Linux 7, which comes with PHP 5.4, but we need, and have installed, PHP 7.1 using the Software Collections
rh-php71 package. Apache and therefore Drupal work fine with PHP 7.1, but we also need to add the drush cron jobs to our crontab, and ensure that drush is using the newer version of PHP when it does so. We have tested to see if drush (we have drush 8.1.10 installed) will run with the default PHP 5.4, just in case, but the cron jobs understandably crash with errors.
We have tried to test the cron command (in the way that you would normally attempt to run a command within a scl wrapper), by running the following as root:
scl enable rh-php71 drush cron -r /data/webs/www/siteroot
but this will not run, returning the error:
Unable to open /etc/scl/conf/drush!
Further testing (in a terminal) shows that we can however successfully run the drush command within a subshell which is within a scl wrapper:
scl enable rh-php71 bash drush cron -r /data/webs/www/siteroot exit
Is there some way that we can run the necessary drush commands just as a 'one-liner' in the crontab, or do I have no option but to have to create a separate shell script containing the above commands, and call that as the cron job command instead?
(I have also asked this question on Drupal.SE, although it seems more of a Linux question than a Drupal one as such, having had no responses on Unix.SE.)