Backup script

xuseronline

Verified User
Joined
Jul 10, 2019
Messages
25
We moved our servers from cPanel to Directadmin 2 months ago.
While we were using cPanel, we had a script ( appended below ) which we use to create backup of each cPanel user and than upload to Dropbox.

Code:
#!/bin/bash
cat /etc/trueuserdomains | cut -d : -f 2 > /root/tmp/accts.txt
for fn in `cat /root/tmp/accts.txt`; do
/scripts/pkgacct $fn
/usr/bin/dropbox_uploader.sh upload /home/cpmove-$fn.tar.gz /server-name/cpmove-$fn.tar.gz
rm /home/cpmove-$fn.tar.gz
done
from trueuserdomains , we could get the list of the cPanel users and loop them, generate backup and upload to Dropbox.

In DirectAdmin, I can get the list of the user using

Code:
ls /usr/local/directadmin/data/users
Using following I can generate the backup via command line:

Code:
echo "action=backup&append%5Fto%5Fpath=nothing&database%5Fdata%5Faware=yes&email%5Fdata%5Faware=yes&local%5Fpath=%2Fhome%2Fadmin%2Fadmin%5Fbackups&owner=admin&select%30=$fn&type=admin&value=multiple&when=now&where=local" >> /usr/local/directadmin/data/task.queue
All well, except one issue.

in cPanel, backup is generated in cpmove-username.tar.gz name format ( no root / reseller name is prefixed to backup file name) so I know what is the file name which I need to upload.

But in DA, backup is generated in different name format. It prepends admin/reseller username to the file name so I am not sure what would be the exact file name.

Could anybody help me how can I find exact file name so that I pass this to my script for backup?

Any inputs are highly appreciated :)
 
Top