Hello
I would like to create a bash script where part of it would be to create a backup via Admin transfer / restore function of DirectAdmin from command line. So I have the following command:
echo "action=backup&append%5Fto%5Fpath=nothing&database%5Fdata%5Faware=yes&email%5Fdata%5Faware=yes&local%5Fpath=%2Fbackup%2Fdysk%5Ffull&owner=mx&select%30=dysk&trash%5Faware=yes&type=admin&value=multiple&when=now&where=local" >> /usr/local/directadmin/data/task.queue
and this command works OK, creates the backup, however it passes the command to the task.queue file so it is run from there in the background and returns to prompt immediately, the problem with this is that I want to do further actions after create the backup. So my question is how can I run backup creation directly from the script without redirection to task.queue (in foreground) so I can do next steps after backup finishes? Below I wil describe what I want to do so maybe someone will tell me the better solution?
I have couple accounts in my server, but one of the account have large directory called data under domains/mydomain.com/ so I exclude this directory from the backup by using backup_exclude_paths file. After every backup I push all *.tar.gz backup files from local directory to the remote box with rsync that data folder too separately to that remote box as well by using all_backup_post.sh script.
What I want to do is to make a full backup once a month of that account to the remote machine (with the data folder) to the separate directory) so I created the following script:
#!/bin/sh
mv /home/dysk/.backup_exclude_paths /home/dysk/.backup_exclude_paths_disabled
echo "action=backup&append%5Fto%5Fpath=nothing&database%5Fdata%5Faware=yes&email%5Fdata%5Faware=yes&local%5Fpath=%2Fbackup%2Fdysk%5Ffull&owner=mx&select%30=dysk&trash%5Faware=yes&type=admin&value=multiple&when=now&where=local" >> /usr/local/directadmin/data/task.queue
rsync -ave "ssh -p22522" /backup/dysk_full/* [email protected]:/home/backup/dysk_full
mv /home/dysk/.backup_exclude_paths_disabled /home/dysk/.backup_exclude_paths
and I will run that script once a month by cron.
however if I have prompt immediately after echo.... command the rest of this script is useless, because I don't have proper tar,gz file to rsync yet. Can anyone help me?
I would like to create a bash script where part of it would be to create a backup via Admin transfer / restore function of DirectAdmin from command line. So I have the following command:
echo "action=backup&append%5Fto%5Fpath=nothing&database%5Fdata%5Faware=yes&email%5Fdata%5Faware=yes&local%5Fpath=%2Fbackup%2Fdysk%5Ffull&owner=mx&select%30=dysk&trash%5Faware=yes&type=admin&value=multiple&when=now&where=local" >> /usr/local/directadmin/data/task.queue
and this command works OK, creates the backup, however it passes the command to the task.queue file so it is run from there in the background and returns to prompt immediately, the problem with this is that I want to do further actions after create the backup. So my question is how can I run backup creation directly from the script without redirection to task.queue (in foreground) so I can do next steps after backup finishes? Below I wil describe what I want to do so maybe someone will tell me the better solution?
I have couple accounts in my server, but one of the account have large directory called data under domains/mydomain.com/ so I exclude this directory from the backup by using backup_exclude_paths file. After every backup I push all *.tar.gz backup files from local directory to the remote box with rsync that data folder too separately to that remote box as well by using all_backup_post.sh script.
What I want to do is to make a full backup once a month of that account to the remote machine (with the data folder) to the separate directory) so I created the following script:
#!/bin/sh
mv /home/dysk/.backup_exclude_paths /home/dysk/.backup_exclude_paths_disabled
echo "action=backup&append%5Fto%5Fpath=nothing&database%5Fdata%5Faware=yes&email%5Fdata%5Faware=yes&local%5Fpath=%2Fbackup%2Fdysk%5Ffull&owner=mx&select%30=dysk&trash%5Faware=yes&type=admin&value=multiple&when=now&where=local" >> /usr/local/directadmin/data/task.queue
rsync -ave "ssh -p22522" /backup/dysk_full/* [email protected]:/home/backup/dysk_full
mv /home/dysk/.backup_exclude_paths_disabled /home/dysk/.backup_exclude_paths
and I will run that script once a month by cron.
however if I have prompt immediately after echo.... command the rest of this script is useless, because I don't have proper tar,gz file to rsync yet. Can anyone help me?
Last edited: