Article 6QTH4 Can't get a cronjob working right

Can't get a cronjob working right

by
EmmJay63
from LinuxQuestions.org on (#6QTH4)
Hello @ all

I'm running a server based on Debian 12 with docker, portainer and some apps like PaperlessNGX, Filebrowser, ... For backup I've set up a bash script that will run at midnight to make some backups and to shutdown the server until it reboots at 0800 (Bios, RTC-initiated).
Part one is mirroring a directory
Code:source=/home/chef/drives/4TB_A/
target=/home/chef/drives/backup/4TB_B
/usr/bin/rsync -auhE --delete --stats $source $target >> $logfileand that works good. Part two is running an export of Paperless documents
Code:/usr/bin/docker exec -it paperless-ngx-webserver-1 document_exporter ../export/ -z --delete
if [ $? -eq 0 ]
then
# worked fine
else
# didn't do the job
fiCrontab was created with Code:sudo crontab -eThe problem is:
while running the script in a terminal as sudo it works perfectly but it fails when running as a cronjob.
What is my mistake?
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments