Why doesn't my crontab -e execute the .sh script?

If you add your cronjob via sudo crontab -e, it will run as root.

  • No need for sudo, use:

    */5 * * * * /bin/sh /home/rki/docker-compose-stuff/dokuwiki/backups/dokuwiki_backup.sh
    
  • The default working directory should be roots $HOME, so usually /root. You can find $name.tar.gz there. But better to use absolute paths, e.g.:

    /bin/tar -zcvf "/home/rki/Backups/$name.tar.gz" /var/lib/docker/volumes/dokuwiki_data