Крон не копирует мое монго DB

У меня есть проблема с моим Кроном на Ubuntu 16.04. Я проверил, что сервис крона в порядке, но скрипты, которые создают монго резервные копии DB, вероятно, не запущены.

Это - мое/etc/crontab содержание файла:

# /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 )
#

и вот мое db_backup.sh содержание файла:

#!/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

Когда я работаю в терминале: sh/etc/cron.hourly/db_backup.sh

Создавать монго DB копируют с именем даты dir в/db_backups/somedate

Почему мой сценарий, не работающий каждые 10 минут и 1 час?
Поскольку Вы видите, что я помещаю сценарий в cron.hourly папку, но мелочей не происходят никакие 10 минуты или 1 час.

1
задан 31 May 2017 в 15:43

2 ответа

Я действительно обновил некоторые свои файлы здесь и успешно создал крон для обновления моего монго DB ежедневно больше деталей здесь: https://stackoverflow.com/questions/44296616/cron-job-doesnt-work-ubuntu-16-04/44296690? noredirect=1#comment75599631_44296690

0
ответ дан 7 December 2019 в 12:33

От DEBIAN SPECIFIC раздел man cron:

   As  described  above, the files under these directories have to be pass
   some sanity checks including the following: be executable, be owned  by
   root,  not  be  writable  by  group or other and, if symlinks, point to
   files owned by root. Additionally, the file names must conform  to  the
   filename  requirements  of  run-parts: they must be entirely made up of
   letters, digits and can only  contain  the  special  signs  underscores
   ('_')  and  hyphens  ('-').  Any  file  that  does not conform to these
   requirements will not be executed by run-parts. For example, any  file
   containing  dots  will  be  ignored.  This is done to prevent cron from
   running any of the files that are left by the Debian package management
   system when handling files in /etc/cron.d/ as configuration files (i.e.
   files ending in .dpkg-dist, .dpkg-orig, and .dpkg-new).
3
ответ дан 7 December 2019 в 12:33

Другие вопросы по тегам:

Похожие вопросы: