Skip to content

Commit fa0cac0

Browse files
committed
Merge pull request #13 from sund/quota
Issue #12 add quota cmd
2 parents cae6926 + aa06877 commit fa0cac0

2 files changed

Lines changed: 35 additions & 12 deletions

File tree

auto-gitlab-backup.conf.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ RVM_envPath=""
1111
## only use the below settings if your destination is using rsync in daemon mode
1212
remoteModule=""
1313
rsync_password_file=""
14+
checkQuota="" #change to true or 1 to enable

auto-gitlab-backup.sh

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,28 +72,49 @@ rakeBackup() {
7272
rsyncUp() {
7373
# rsync up with default key
7474
echo =============================================================
75-
echo -e "Start rsync to \n$remoteServer:$remoteDest\ndefault key"
76-
echo =============================================================
75+
echo -e "Start rsync to \n$remoteServer:$remoteDest\ndefault key\n"
7776
rsync -Cavz --delete-after -e "ssh -p$remotePort" $gitRakeBackups/ $remoteUser@$remoteServer:$remoteDest
7877
}
7978

8079
rsyncKey() {
8180
# rsync up with specific key
8281
echo =============================================================
83-
echo -e "Start rsync to \n$remoteServer:$remoteDest\nwith specific key"
84-
echo =============================================================
82+
echo -e "Start rsync to \n$remoteServer:$remoteDest\nwith specific key\n"
8583
rsync -Cavz --delete-after -e "ssh -i $sshKeyPath -p$remotePort" $gitRakeBackups/ $remoteUser@$remoteServer:$remoteDest
8684
}
8785

8886
rsyncDaemon() {
8987
# rsync up with specific key
9088
echo =============================================================
91-
echo -e "Start rsync to \n$remoteUser@$remoteServer:$remoteModule\nin daemon mode"
92-
echo =============================================================
89+
echo -e "Start rsync to \n$remoteUser@$remoteServer:$remoteModule\nin daemon mode\n"
9390
rsync -Cavz --port=$remotePort --password-file=$rsync_password_file --delete-after /$gitRakeBackups/ $remoteUser@$remoteServer::$remoteModule
9491

9592
}
9693

94+
sshQuotaKey() {
95+
#quota check: with a key remoteServer, run the quota command
96+
if [[ $checkQuota == "true" || $checkQuota = 1 ]]
97+
then
98+
echo =============================================================
99+
echo -e "Quota check: \n$remoteUser@$remoteServer:$remoteModule\nwith key\n"
100+
ssh -p $remotePort -i $sshKeyPath $remoteUser@$remoteServer "quota"
101+
echo =============================================================
102+
103+
fi
104+
}
105+
106+
sshQuota() {
107+
#quota check: assuming we can ssh into remoteServer, run the quota command
108+
if [[ $checkQuota == "true" || $checkQuota = 1 ]]
109+
then
110+
echo =============================================================
111+
echo -e "Quota check: \n$remoteUser@$remoteServer:$remoteModule\n"
112+
ssh -p $remotePort $remoteUser@$remoteServer "quota"
113+
echo =============================================================
114+
115+
fi
116+
}
117+
97118
printScriptver() {
98119
# print the most recent tag
99120
echo "This is $0"
@@ -125,16 +146,17 @@ cd $PDIR
125146
if [[ $remoteModule != "" ]]
126147
then
127148
rsyncDaemon
128-
149+
129150
# no Daemon so lets see if we are using a special key
130151
else if [ -e $sshKeyPath -a -r $sshKeyPath ] && [[ $sshKeyPath != "" ]]
131152
then
132-
133153
rsyncKey
134-
else if [[ $remoteServer != "" ]]
135-
then
136-
# use the defualt
137-
rsyncUp
154+
sshQuotaKey
155+
else if [[ $remoteServer != "" ]]
156+
then
157+
# use the defualt
158+
rsyncUp
159+
sshQuota
138160
fi
139161
fi
140162
fi

0 commit comments

Comments
 (0)