To determine in a script how much available disk space you have, use the program "sftp" in Linux-based systems:
echo "df" | sftp <sr-your_storage_number>.mycoreserver.com
echo "df -h" | sftp <sr-your_storage_number>.mycoreserver.com
echo "df -hi" | sftp <sr-your_storage_number>.mycoreserver.com
Under certain circumstances, lftp
can return wrong values; therefore it is better to use the variant with sftp. Below is the variant with lftp:
# apt-get install lftp
# echo du -hs . \
| lftp -u <username>,<password> BACKUPSERVER
You can also embed the command in Tartarus using a hook. To do this, insert the following lines into the Tartarus configuration:
TARTARUS_POST_PROCESS_HOOK() {
echo "du" | /usr/bin/lftp -u "$STORAGE_FTP_USER,$STORAGE_FTP_PASSWORD" "$STORAGE_FTP_SERVER" | awk -v LIMIT=100 '$2=="." {print ((LIMIT*1024*1024)-$1)/1024 " MiB backup space remaining"}'
}
Got a question? Connect with us and Create a Ticket.