This commit is contained in:
BoHung Chiu 2022-08-25 17:45:31 +08:00
parent 574b9f6708
commit e2b5f71716
1 changed files with 4 additions and 4 deletions

View File

@ -258,28 +258,28 @@ if [[ "$sudo_crontab_jobs" =~ "@reboot /bin/bash -l -c" ]]; then
push_messages "Already exist reboot crontab!"
else
push_messages "Adding reboot crontab!"
push_messages "$sudo_crontab_jobs"$'\n''@reboot /bin/bash -l -c "rm -f /tmp/mongodb-27017.sock && chown mongodb:mongodb /var/lib/mongodb/ -R && chown mongodb:mongodb /var/log/mongodb -R && /usr/sbin/service mongod restart && /etc/init.d/orbit restart"'| sudo crontab -
echo "$sudo_crontab_jobs"$'\n''@reboot /bin/bash -l -c "rm -f /tmp/mongodb-27017.sock && chown mongodb:mongodb /var/lib/mongodb/ -R && chown mongodb:mongodb /var/log/mongodb -R && /usr/sbin/service mongod restart && /etc/init.d/orbit restart"'| sudo crontab -
fi
sudo_crontab_jobs=$(sudo crontab -l)
if [[ "$sudo_crontab_jobs" =~ "mongodump -o /" ]]; then
push_messages "Already exist mongodump crontab!"
else
push_messages "Adding mongodump crontab!"
push_messages "$sudo_crontab_jobs"$'\n''0 3 * * * mongodump -o /home/backup/db/`date "+\%Y\%m\%d"`_db'| sudo crontab -
echo "$sudo_crontab_jobs"$'\n''0 3 * * * mongodump -o /home/backup/db/`date "+\%Y\%m\%d"`_db'| sudo crontab -
fi
sudo_crontab_jobs=$(sudo crontab -l)
if [[ `echo "$sudo_crontab_jobs" | grep -P "rm -fr.*/db/"` ]]; then
push_messages "Already exist remove old mongo backup crontab!"
else
push_messages "Adding remove old mongo backup crontab!"
push_messages "$sudo_crontab_jobs"$'\n''0 4 * * * rm -fr /home/backup/db/`date --date="1 week ago" "+\%Y\%m\%d"`_db'| sudo crontab -
echo "$sudo_crontab_jobs"$'\n''0 4 * * * rm -fr /home/backup/db/`date --date="1 week ago" "+\%Y\%m\%d"`_db'| sudo crontab -
fi
sudo_crontab_jobs=$(sudo crontab -l)
if [[ "$sudo_crontab_jobs" =~ "/usr/bin/rsnapshot" ]]; then
push_messages "Already exist rsnapshot crontab!"
else
push_messages "Adding rsnapshot crontab!"
push_messages "$sudo_crontab_jobs"$'\n''15 4 * * * /usr/bin/rsnapshot daily'| sudo crontab -
echo "$sudo_crontab_jobs"$'\n''15 4 * * * /usr/bin/rsnapshot daily'| sudo crontab -
fi
push_messages "Finish setting orbit environment!"
push_messages "Please install orbit web app and setting nginx for single web by yourself!"