A
A
Andrey Berezhnoy2014-03-09 15:00:07
Backup
Andrey Berezhnoy, 2014-03-09 15:00:07

How to integrate python-swiftclient into sbackup.sh (Selectel)?

I use the services of the Selectel company to store backup copies of my project.
The guys have prepared an excellent instruction , but now I am faced with such a problem.
The archived site now exceeds the 5GB limit for the supload utility . Tech support suggested using python-swiftclient (at the end of the manual it is written about it) , but I can't "put" it into their sbackup shell utility . Actually, here is the part responsible for downloading the backup:

# ------- Upload backups -------
echo "$(date +%H:%M:%S) Uploading backup files to Selectel Storage..." | _log

for _file in "${_for_upload[@]}"; do
  _u_opts=""
  if [ -n "$STORAGE_EXPIRE" ]; then
    _u_opts="-d ${STORAGE_EXPIRE}d"
  fi
  $SUPLOAD -u "$SS_USER" -k "$SS_PWD" $_u_opts "$SS_CONTAINER" "$_file" | _log
  if [ $? -ne 0 ]; then
    _error="1"
  else
    if [ x"$DELETE_BACKUPS_AFTER_UPLOAD" = x"yes" ]; then
      rm -f "$_file"
      echo "$(date +%H:%M:%S) File $_file was removed" | _log
    fi
  fi
done

The sbackup utility itself .
I would be grateful if someone could help integrate python-swiftclient there , together with their supload .

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
faustoFF, 2014-03-17
@AndreyBerezhnoy

I have it done like this:

# ------- Upload backups -------
echo "$(date +%H:%M:%S) Uploading backup files to Selectel Storage..." | _log

cd "$BACKUP_DIR"
for _file in "${_for_upload[@]}"; do
        _u_opts=""
        if [ -n "$STORAGE_EXPIRE" ]; then
                _u_opts="-d ${STORAGE_EXPIRE}d"
        fi
        FILENAME=$(basename "$_file")
        nice -n 19 ionice -c 3 swift upload -A https://auth.selcdn.ru -U "$SS_USER" -K "$SS_PWD" -S 1073741824 "$SS_CONTAINER" "$FILENAME" | _log
        if [ $? -ne 0 ]; then
                _error="1"
        else
                if [ x"$DELETE_BACKUPS_AFTER_UPLOAD" = x"yes" ]; then
                        rm -f "$_file"
                        echo "$(date +%H:%M:%S) File $_file was removed" | _log
                fi
        fi
done

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question