How to stop a backup?

Hello,

I am new to restic and set up backups to S3. How can I stop an ongoing backup?

To launch a backup I have to do this each time?:

    export AWS_ACCESS_KEY_ID="votre_cle_api_publique"
    export AWS_SECRET_ACCESS_KEY="votre_cle_api_privee"
    restic -r s3:s3.example.com/sauvegarde backup /home/toto 

So, if I understand well, each time I have to enter export AWS_ACCESS_KEY_ID and export AWS_SECRET_ACCESS_KEY before launching restic -r s3:s3.example.com/sauvegarde backup /home/toto , am I right?

Do you have any recommendations/settings when backing up to s3? Or recommendations for sbdy new to restic?

Thank you.

Just press Ctrl+C or kill the restic process. Restic will (simply put, without too much technical detail) continue where it left off next time you run it.

If you run it manually in the shell, then yes you have to make sure that the environment variables are set. If you did it once, and then run restic again in the same terminal session, the environment variables will of course still be set.

You can do things like wrap it all in a script, and preferably have the environment variables in that script set by being read from a secured file, or similar.

Nothing in particular, but perhaps someone else has some pro tips.

That question is a bit too broad to have a simple answer :slight_smile:

2 Likes

If you are using linux, then you can create the environment variables by putting them in a file. Eg .restics3.env and setting the permissions to read only for all except root. The contents would appear similar to:

export AWS_ACCESS_KEY_ID=zzzzzzzzzzzzzzzzzzzzzzzzzz
export AWS_SECRET_ACCESS_KEY=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
export RESTIC_PASSWORD="zzzzzzzzzzzzzzzzzzzzzzzzzzzz"
export RESTIC_REPOSITORY="s3:https://s3.amazonaws.com/restic-bucketname"

To set the variables from a script, add the following before using restic:
source /path/to/.restics3.env

To set them from the terminal, simply type the above. With this example you won’t need to specify the -r argument.

1 Like

I think it’s best to be clear here: The features you describe are not features of Linux; they are features of the Bourne shells. (In particular, they should also work on macOS, since that defaults to bash/zsh. There are also Linux setups where it won’t work, but those aren’t at issue here.)

1 Like

Thank you all for your replies.