summaryrefslogtreecommitdiffstats
path: root/misc/rsnapshot/contrib/rsnapshot_monthly
blob: 096d419b21e674fe534c6a7d56e0f89b4cd6c9f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

INTERVAL="monthly"
RSNAPSHOT="/usr/bin/rsnapshot"
MOUNTPOINT="/backup"
LOGFILE="/var/log/rsnapshot"
PIDFILE="/var/run/rsnapshot.pid"

# Check to make sure rsnapshot isn't currently running

if [[ -f "$PIDFILE" ]]; then
   echo "$PIDFILE already exists, skipping "$INTERVAL" run" >> "$LOGFILE"
   exit
fi

# remount filesystem read/write
mount -o remount,rw "$MOUNTPOINT"

# call rsnapshot
"$RSNAPSHOT" "$INTERVAL"

# remount filesystem read-only
mount -o remount,ro "$MOUNTPOINT"