Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Git pull inside root crontab
# crontab (by executing sudo opens up root crontab)
sudo crontab -e
# every 1 minute pull changes (if any) and replace $user with real username
*/1 * * * * su -s /bin/sh $user -c 'cd /var/www/html/src && /usr/bin/git pull origin master && /usr/bin/git checkout master'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment