lobaro / restic-backup-docker

A docker container to automate backups with restic
Apache License 2.0
344 stars 113 forks source link

How to check backup progress? #54

Open Mastergalen opened 4 years ago

Mastergalen commented 4 years ago

I would like to check the progress of my backups but have been unable to get the progress to print using SIGUSR1, as documented in the restic docs.

Additionally on Unix systems if restic receives a SIGUSR1 signal the current progress will be written to the standard output so you can check up on the status at will.

The steps I followed inside the Docker container are:

/home # ps aux
PID   USER     TIME  COMMAND
    1 root      0:01 tail -fn0 /var/log/cron.log
   40 root      0:00 crond
   41 root      0:00 ash
   46 root      0:21 ash
   91 root      0:00 /usr/bin/flock -n /var/run/backup.lock /bin/backup
   92 root      0:00 {backup} /bin/sh /bin/backup
   97 root      0:00 restic backup /data --exclude="@eaDir/" --tag=
  106 root      0:00 rclone serve restic --stdio --b2-hard-delete --drive-use-trash=fa
  123 root      0:00 ps aux

Send SIGUSR1 signal to PID 97

kill -SIGUSR1 97

No progress is printed to /var/log/cron.log.

I also tried viewing stdout for PID 97 with tail -f /proc/97/fd/1, but still nothing, unfortunately.

jonpavelich commented 3 years ago

I encountered the same issue. It looks like restic output is written to /var/log/backup-last.log rather than /var/log/cron.log. After sending a SIGUSR1 signal to the restic process, I was able to view the progress report in /var/log/backup-last.log.

koelle25 commented 1 year ago

I encountered the same issue. It looks like restic output is written to /var/log/backup-last.log rather than /var/log/cron.log. After sending a SIGUSR1 signal to the restic process, I was able to view the progress report in /var/log/backup-last.log.

Thanks! For others also wanting to check progress, here's how to do it. You can execute the commands directly on the host system (you don't need to be inside the container for this to work):

  1. Find PID of the restic process. You can either try using pgrep -f restic or pidof restic, or use the "raw" method of ps -ef | grep "[r]estic" (the encased [r] will make it so you only get the line with the actual restic process, but not the current "grep restic" process line). Example output:
    root@ubuntu:~# ps -ef | grep -E "[r]estic"
    root     23852 23847  2 05:59 ?        00:12:58 restic backup /data --tag=
  2. Send the signal: kill -SIGUSR1 <pid>, so for the example above it would be kill -SIGUSR1 23852 (23847 would be the parent process PID (PPID)).
  3. Check the log: docker exec <container-name> tail /var/log/backup-last.log, e.g.:
    root@ubuntu:~# docker exec restic-backup tail /var/log/backup-last.log
    ...
    [7:59:38] 20.61%  102383 files 66.617 GiB, total 380366 files 323.189 GiB, 0 errors ETA 80:29:11
    /data/backup/appdata/ab_20230906_010003/plex.tar.gz
    /data/backup/appdata/ab_20230907_010001/nextcloud.tar.gz