Help - Search - Members - Calendar
Full Version: Simple Cron Just Does Not Want To Run
Linuxhelp > Support > Technical Support
Kikkilatzi
Hiya everyone,

I am trying to solve this problem for about a week now.
I need to install a cron for running an automatic maintenance script every hour.

We have SUSE 8.1 Linux installed on our webserver.

We could use curl or wget to run the script.
This is what we have to install into the cron.

# if your server supports curl:
0 * * * * curl -s -o /dev/null http://your.server.name.here/phpAdsNew/mai...maintenance.php

# if your server supports wget:
0 * * * * wget -q -O /dev/null http://your.server.name.here/phpAdsNew/mai...maintenance.php


We tried both, wget and curl but the script does not run.
How could I write an error message into a file. Right now /dev/null eliminates the option to have error messages recorded. I do not know the correct syntax on how to change that into a /dev/filename.txt or something like that?

When I copy the URL and enter the exact same URL in my webbrowser the scrip runs and does its job.
The problem is definately that the cron does not run.

This is the result when I call up cron by -----> cron -l

$ crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (cron.txt installed on Fri Feb 6 13:20:22 2004)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
0 * * * * /usr/bin/curl -s -o /dev/null http://www.myserver.de/phpAdsNew/maintenan...maintenance.php


Soemeone told us that we have to use the full path for the curl application that is why we did not copy the suggested line 1:1 but added /usr/bin/curl instead of just using curl -s -o We tried both ways but none worked.

Hope you have an idea what might be the problem.

Dee
hughesjr
instead of writting the output to /dev/null .... write the output to a file ... like this:

CODE
0 * * * * /usr/bin/curl -s -o /var/log/maintenance.log http://your.server.name.here/phpAdsNew/maintenance/maintenance.php


Then you can look at the file /var/log/maintenance.log and see when the cron ran and what the page looked like.
Kikkilatzi
Thanx for your help.

I am a bit smarter now. I found out that our server has a totally messed up configuration.

I edited the cron so that a log file is written. Nothing happened.

Then I checked the server for cron jobs and found out that the normal directory where cron jobs are stored is not even present. Instead I found different directories like:

cron.d
cron.daily
cron.hourly
cron.monthly
cron.weekly

In the cron.daily I found a lot of jobs which seem to run. In the cron.d was only one job which definatly also runs. I edited the file and added my job to that file. NOW it works!

The problem is that this file was generated by the sever software confixx and it will probably be overwritten whenever I edit anything about the configuration. I tried to add my cron into that directory but that did not work either.
For now I have at least the cron running but I am pretty mad at the server guys who setup the system in this way. The normal way how a cron should be added does not work at all. It is just not started.

Maybe someone knows a bit more about this kind of server setup for cron jobs. It could help a lot of others as well whose cron is not working as it should.

Best greets

Dee
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.