Skip to content

Commit eb1dc84

Browse files
committed
Restart mongod on standalone script
1 parent 4ab0fae commit eb1dc84

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

bin/scripts/mongodb.init.logrotate.sh

+17
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,23 @@ EOF
3939
}
4040
EOF
4141
fi
42+
43+
if [ -f /etc/redhat-release ]; then
44+
#mongodb might need to be started
45+
if grep -q -i "release 6" /etc/redhat-release ; then
46+
service mongod restart || echo "mongodb service does not exist"
47+
else
48+
systemctl restart mongod || echo "mongodb systemctl job does not exist"
49+
fi
50+
fi
51+
52+
if [ -f /etc/lsb-release ]; then
53+
if [[ "$(/sbin/init --version)" =~ upstart ]]; then
54+
restart mongod || echo "mongodb upstart job does not exist"
55+
else
56+
systemctl restart mongod || echo "mongodb systemctl job does not exist"
57+
fi
58+
fi
4259
else
4360
echo 'Command logrotate is not found, continuing without logrotate setup.'
4461
fi

0 commit comments

Comments
 (0)