1

I am mounting my remote backup volume using a rsnapshot cmd_preexec script.

If the /mnt/backup directory doesn't exist when starting rsnapshot i get this error:

ERROR: /mnt/backup does not exist.  

If the directory exists and the preexec mounting fails, it does not stop rsnapshot resulting in the backup being backed up on the completely wrong server...

What should I do about this?

Edit:
I know that I could use a wrapper-script, but I don't want to do this..

Zulakis
  • 4,153
  • 14
  • 48
  • 76

2 Answers2

1

Oh well, looks like i DO have to use a wrapper script.

If anyone has a better idea, feel free to post.

Zulakis
  • 4,153
  • 14
  • 48
  • 76
0

I know that I could use a wrapper-script, but I don't want to do this..

So you know an easy solution exists. Why not use this?

Anyway, it's even documented. Set your snapshot_root to e.g. /mnt/remotefs/.snapshot where /mnt/remotefs is the mount point of your remote/loopback fs and also set no_create_root to 1. rsnapshot will now fail if it can't find it's snapshot root dir.

Sven
  • 98,649
  • 14
  • 180
  • 226
  • Hehe, `ERROR: /mnt/backup/.snapshot does not exist.` – Zulakis Sep 22 '12 at 15:41
  • no_create_root DOES prevent rsnapshot from creating the backup directory. Instead it just stops, as I already pointed out in my initial posting. – Zulakis Sep 22 '12 at 15:42
  • Yes, exactly. This is what you (should) want. Your mount script failed, so you need to prevent `rsnapshot` from doing the backup anyway. What else should it do about this problem? You could enhance your preexec mount script to inform you if it failed so you at least notice it. – Sven Sep 22 '12 at 15:45
  • rsnapshot checks if the directory exists BEFORE executing the mount-script. That's what i'm trying to point out. – Zulakis Sep 22 '12 at 15:49
  • And because of this I got to risk backing up to the wrong server, which I really don't want. – Zulakis Sep 22 '12 at 15:50
  • So, you will need a wrapper script in the end. – Sven Sep 22 '12 at 15:50
  • Looks like. I was wondering if anyone knew a method on how to tell rsnapshot NOT to behave like this... – Zulakis Sep 22 '12 at 15:52