Skip to content

Instantly share code, notes, and snippets.

@luukverhoeven
Created September 15, 2022 20:08
Show Gist options
  • Save luukverhoeven/2a05963dd0adb8981cbd7afe26cdf1d6 to your computer and use it in GitHub Desktop.
Save luukverhoeven/2a05963dd0adb8981cbd7afe26cdf1d6 to your computer and use it in GitHub Desktop.
if [[ $(crontab -l | grep -q '/public_html/admin/cli/cron.php'; echo $?) == 1 ]]
then
crontab -l >/tmp/crontab.tmp
echo -e '\n* * * * * /usr/bin/php7.4 ~/public_html/admin/cli/cron.php > /dev/null 2>&1' >>/tmp/crontab.tmp
crontab /tmp/crontab.tmp
rm /tmp/crontab.tmp
echo 'Installed the crontab'
else
echo 'Skip the crontab installation, already there'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment