-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1438 from arooshap/mongo-eos
Changes to the MongoDB setup.
- Loading branch information
Showing
10 changed files
with
68 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Print a message to indicate the script is running | ||
echo "copy_cron.sh is running" | ||
|
||
if [ "$ENVIRONMENT" = "prod" ]; then | ||
# Copy the production cron file | ||
echo "Copying mongo-prod.cron" | ||
cp /data/tools/mongo-prod.cron /data/tools/mongo.cron | ||
elif [ "$ENVIRONMENT" = "preprod" ]; then | ||
# Copy the development cron file | ||
echo "Copying mongo-preprod.cron" | ||
cp /data/tools/mongo-preprod.cron /data/tools/mongo.cron | ||
elif [ "$ENVIRONMENT" = "test" ]; then | ||
# Copy the test cron file | ||
echo "Copying mongo-test.cron" | ||
cp /data/tools/mongo-test.cron /data/tools/mongo.cron | ||
else | ||
echo "Unsupported environment: $ENVIRONMENT" | ||
exit 1 | ||
fi | ||
|
||
# Set up the cron job | ||
crontab /data/tools/mongo.cron | ||
|
||
# Add another cronjob to get kerberos token once everyday | ||
(crontab -l ; echo "0 0 * * * /root/run.sh") | crontab - | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
0 */12 * * * export AGE_KEY="/etc/mongodb-secret/age-key.txt" && /data/tools/mongo_manage.sh backup /etc/mongodb-secret/mongo.ini | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
0 */4 * * * export AGE_KEY="/etc/mongodb-secret/age-key.txt" && /data/tools/mongo_manage.sh backup /etc/mongodb-secret/mongo.ini | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
0 2 * * * export AGE_KEY="/etc/mongodb-secret/age-key.txt" && /data/tools/mongo_manage.sh backup /etc/mongodb-secret/mongo.ini | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
#!/bin/bash | ||
### This script relies on provided keytab file which will be | ||
### be mounted to /etc/krb area | ||
if [ -f /etc/krb ]; then | ||
if [ -d /etc/krb ]; then | ||
echo "Starting the kinit operation!" | ||
export keytab=/etc/krb/cmsweb.keytab | ||
principal=`klist -k "$keytab" | tail -1 | awk '{print $2}'` | ||
kinit $principal -k -t "$keytab" 2>&1 1>& /dev/null | ||
kinit $principal -k -t "$keytab" >/dev/null 2>&1 | ||
if [ $? == 1 ]; then | ||
echo "Unable to perform kinit operation for cmsweb keytab." | ||
exit 1 | ||
fi | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters