CronJob на сервере человечности

Tryin для конфигурирования для двух запущенных приложений на моем сервере, двух CronJob.

Команда, которую я должен поместить в ConrJob:

wget -q -O- http://myDOMAIN/cron/index

Я уже сделал:

crontab -e

Редактирования на файле:

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
*/1 * * * * wget -q -O- http://myDOMAIN/cron/index
*/1 * * * * wget -q -O- http://myDOMAIN2/cron/index

Но я не получаю успешно почтовое уведомление от APP. В папке Maildir,/home/master/(владеют mailserver), я просто получил следующее сообщение:

Return-Path: <master@myDOMAIN>
X-Original-To: master
Delivered-To: master@myDOMAIN
Received: by myDOMAIN (Postfix, from userid 1000)
    id 0DA2F1A1F2B; Fri, 16 Jun 2017 16:42:01 +0200 (CEST)
From: root@myDOMAIN (Cron Daemon)
To: master@myDOMAIN
Subject: Cron <master@node01-ubuntu> /myDOMAIN/cron/index
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/master>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=master>
Message-Id: <20170616144201.0DA2F1A1F2B@mmyDOMAIN>
Date: Fri, 16 Jun 2017 16:42:01 +0200 (CEST)

/bin/sh: 1: /myDOMAIN/cron/index: not found
2
задан 16 June 2017 в 17:52

2 ответа

cronjobs нужен полный путь: попробуйте
/usr/bin/wget -q -O- http://myDOMAIN/cron/index
или
/ usr / bin / wget -q -O- http: // myDOMAIN / cron / index 2> $ logfile
и добавьте $ logfile в свою почту

1
ответ дан 2 December 2019 в 04:48

Вы можете использовать сценарий для этого (например, сценарий, подобный cron.sh):

Внутри вашего сценария добавьте все поведения, которые вы хотите запустить:

#!/bin/bash
wget -q -O- http://myDOMAIN/cron/index
wget -q -O- http://myDOMAIN2/cron/index

затем chmod a+x /path/to/croh.sh

Наконец, добавьте в ваш crontab следующее:

*/1 * * * * /path/to/croh.sh
0
ответ дан 2 December 2019 в 04:48

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

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