Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 1584  / 1 Year ago, tue, november 22, 2022, 5:33:27

I have a problem with my Cron on Ubuntu 16.04. I checked that cron service is up and running but scripts that create Mongo DB backups probably is not run.



This is my /etc/crontab file content:



# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
*/10 * * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.hourly )
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#


and here is my db_backup.sh file content:



#!/bin/sh
DIR=`date +%m%d%y`
DEST=/db_backups/$DIR
mkdir $DEST
mongodump -h localhost:27017 -d dbname -u xxxx -p xxx -o $DEST


When I run in terminal:
sh /etc/cron.hourly/db_backup.sh



Its create Mongo DB backup with dir date name in /db_backups/somedate



Why my script not running every 10 minutes and 1 hour?

As you can see I put script in cron.hourly folder but nothings happen neither 10 minutes or 1 hour.


More From » backup

 Answers
7

I did update some of my files here and successfully created cron for updating my Mongo DB daily more details here:
https://stackoverflow.com/questions/44296616/cron-job-doesnt-work-ubuntu-16-04/44296690?noredirect=1#comment75599631_44296690


[#11107] Thursday, November 24, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
antorchestr

Total Points: 92
Total Questions: 111
Total Answers: 120

Location: Jordan
Member since Wed, Jun 17, 2020
4 Years ago
antorchestr questions
;