Download teleporter backup using the api

Hello,

is there a way to download the teleporter backup using the api?
I know I can download using the interface, but I would like to automate this on a daily basis.

It can be done on the command line too with the command

pihole -a -t
1 Like

thanks, that will work for me, If I run this from the remove machine

ssh -i /root/.ssh/pi-hole -o 'StrictHostKeyChecking=no' pi@192.168.180.10 'pihole -a -t'
scp -i /root/.ssh/pi-hole pi@192.168.180.10:~/* /config/pi-hole/
ssh -i /root/.ssh/pi-hole -o 'StrictHostKeyChecking=no' pi@192.168.180.10 'rm pi-hole-* -f'
find /config/pi-hole/* -type f -mtime +100 -exec rm {} -f \;

By default the filename is dated and timed to the second and owned by root, eg

-rw-r--r--  1 root root     0 May 30 20:25 pi-hole-pihole-teleporter_2023-05-30_20-25-40.tar.gz
-rw-r--r--  1 root root     0 May 30 20:25 pi-hole-pihole-teleporter_2023-05-30_20-25-56.tar.gz

You can specify your own filename if you prefer, so you could use a function or script to create your own desired format or leave it static. See the admin option help

$ pihole -a -h
[...]
  -t, teleporter                  Backup configuration as an archive
  -t, teleporter myname.tar.gz    Backup configuration to archive with name myname.tar.gz as specified

[ Note I am actually getting a PHP error when I run the command, hence the 0 length files above. I don't use this command so haven't looked into why ]

thanks, but for now the original names are ok,
the datatime format works for me,
I'm tweaking the script a little bit, but now, on a daily bases a backup will be created and copied to my home assistant,
where the home assistant backup itself includes this file for the cloud backup.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.