0

I've created cronjob with crontab -u www-data -e and added the following command:

* * * * * cd /var/www/example.com/wp-content/themes/mytheme && /usr/local/bin/git pull origin dev

But it's not pulling in anything. I've also set up custom cron log via rsyslog, but it only shows command, no output. When I run said command as root everything works.

Permissions on dirs and files are setup properly, and owner of said directory is www-data.

Milos
  • 981
  • 3
  • 16
  • 41
  • Did you try running the command using `sudo`? Maybe the user `www-data` does not have the credentials to access the remote repository. – SebDieBln Dec 17 '22 at 11:03
  • 2
    so what happens when you run said command as `www-data` rather than as `root`? when debugging commands run be cron it often helps to wrap everything into a single shell-script and call that (and ad lib debugging printout). – umläute Dec 17 '22 at 11:03
  • 3
    At the very least the proposed duplicate should help you articulate a well-formed question about `cron` problems. If you still need help, please [edit] your question to provide the customary troubleshooting details, starting with any error message delivered to your (or `www-data`'s) email. – tripleee Dec 17 '22 at 11:09
  • add `>> /temp/myjob.log 2>&1` for quick and dirty debugging. +1 on the "wrap all actions in single script with adequate logging" suggestion – LeGEC Dec 17 '22 at 14:41

0 Answers0