This repository was archived by the owner on Apr 9, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcheck_missing_backups.sh
More file actions
executable file
·78 lines (69 loc) · 1.99 KB
/
check_missing_backups.sh
File metadata and controls
executable file
·78 lines (69 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
databases=""
if pgrep -f /usr/bin/mongod > /dev/null; then
if [ ! -f /etc/backup.d/30.mongodb ]; then
if ! grep -q "# ignore mongodb" /etc/backupninja.conf; then
echo "CRITICAL : Missing mongodb backup"
exit 2
fi
else
databases="$databases mongodb"
fi
fi
if pgrep postgres -u postgres > /dev/null; then
if [ ! -f /etc/backup.d/20.pgsql ]; then
if ! grep -q "# ignore postgres" /etc/backupninja.conf; then
echo "CRITICAL : Missing postgresql backup"
exit 2
fi
else
databases="$databases postgres"
fi
fi
if pgrep mysql -u mysql > /dev/null; then
if [ ! -f /etc/backup.d/20.mysql ]; then
if ! grep -q "# ignore mysql" /etc/backupninja.conf; then
echo "CRITICAL : Missing mysql backup"
exit 2
fi
else
databases="$databases mysql"
fi
fi
if pgrep slapd > /dev/null; then
if [ ! -f /etc/backup.d/30.ldap ]; then
if ! grep -q "# ignore ldap" /etc/backupninja.conf; then
echo "CRITICAL : Missing ldap backup"
exit 2
fi
else
databases="$databases slapd"
fi
fi
if pgrep beam -u couchbase > /dev/null; then
if [ ! -f /etc/backup.d/41.sh ]; then
if ! grep -q "# ignore couchbase" /etc/backupninja.conf; then
echo "CRITICAL : Missing couchbase backup"
exit 2
fi
else
databases="$databases couchbase"
fi
fi
if pgrep java -u elasticsearch > /dev/null; then
if [ ! -f /etc/backup.d/40.sh ]; then
if ! grep -q "# ignore elasticsearch" /etc/backupninja.conf; then
echo "CRITICAL : Missing elasticsearch backup"
exit 2
fi
else
databases="$databases elasticsearch"
fi
fi
# :TODO:maethor:190109: Couchbase, couchdb… ?
if [ -z "$databases" ] ; then
echo "OK : no database to backup on this server."
else
echo "OK : $databases backups are configured in backupninja."
fi
exit 0