Crontab function does not work

1

I have a script in php that performs (should at least) some recordings in a txt:

25 11 * * 1-5 wget -q --spider http://10.24.0.42/felipe_projetos/DD/CREATE_TABLE.NULL.IN.php

However, recording does not occur. I suspect at first that the error was in PHP itself, but when I execute the direct file in the browser the recording happens, I do not know if the commands are wrong because I use two other similar commands that work perfectly:

30 22 * * 1-5 wget -q --spider http://10.24.0.42/felipe_projetos/DD/CREATE_TABLE.NULL.php


00 7 * * 1-5 wget -q --spider http://10.24.0.42/felipe_projetos/Poc/ch_ch.php

I changed the file to 777 allowing it to be some kind of block, but it still did not work

    
asked by anonymous 06.03.2018 / 15:34

2 answers

1

I know two ways of scheduling chrome tasks:

1 - run the command crontab -e that will open a window giving a slight description of how you can schedule the tasks in cron, where you can simply paste your cron already created, at the end the window should look like this: / p>

# 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
25 11 * * 1-5 wget -q --spider http://10.24.0.42/felipe_projetos/DD/CREATE_TABLE.NULL.IN.php

In this example there is no need to define a user.

2 - Edit or create your cron in / etc / crontab-d / meucron

vi /etc/cron.d/meucron

Now paste your cron

25 11 * * 1-5 root wget -q --spider http://10.24.0.42/felipe_projetos/DD/CREATE_TABLE.NULL.IN.php

Note that in this second method I defined a user to perform the action. After editing / creating your cron and saving it, restart crontab .

For this second method you must be root to create or edit files in /etc/cron.d/

    
07.03.2018 / 13:55
0

You can run a cron job and make sure that user can run php and have permission to write to the target directory:

Ex. Crontab: 30 22 * * 1-5 USERS wget -q --spider link

    
06.03.2018 / 19:47