Koozali.org: home of the SME Server

Big Cron Problem

Offline jklapp

  • **
  • 32
  • +0/-0
Big Cron Problem
« on: March 26, 2008, 02:12:35 AM »
I'm having a couple of big problems with cron... I setup a cron to run a script and this is what I keep getting in my mail box... (Of course I edited the server name :)

Quote
Cron <root@servernamer> http://www.domainname.com/smf/index.php?module=tRSSNews;sa=updatecache;func=cron;key=77a6dc1ac9364528

/bin/bash: http://www.domainname.com/smf/index.php?module=tRSSNews: No such file or directory


I don't know why it's not working, the command line is correct... but this part is really strange... I deleted it in server-manager, but I keep getting the same error message in my mail box??? (the message comes every minute) Any thoughts???

Thanks :)

Offline the-heck

  • ***
  • 63
  • +0/-0
  • Chance favors the prepared mind.
Re: Big Cron Problem
« Reply #1 on: March 26, 2008, 05:36:34 AM »
Could you provide more info?  If you can give the crons, I may be able to help you check it.

Please provide your custom templates from:

Quote
/etc/e-smith/templates-custom/etc/cron.d
***************
·¨­­­°÷»the-heck«÷°¨·
***************

Offline jklapp

  • **
  • 32
  • +0/-0
Re: Big Cron Problem
« Reply #2 on: March 26, 2008, 03:18:50 PM »
I do not have a "cron.d" in  ... /etc/e-smith/templates-custom/etc/ ... all there is "/home"

But I do have ... /etc/e-smith/templates/etc/cron.d... but all that is there is "/claymav" and that files is dated Aug 19,2005

Now I do have a /etc/cron.d and the files in there are - "claymav" - "purge_junkmail" - "smolt" - "warnquota" but all those files has old dates on them too.

Offline jklapp

  • **
  • 32
  • +0/-0
Re: Big Cron Problem
« Reply #3 on: March 26, 2008, 04:21:14 PM »
I did get the emails to stop.. After removing the cron from server-manager I had to run these commands at shell

/sbin/e-smith/expand-template /etc/crontab
service crond restart

Apparently the commands I entered into the cron server-manager was not correct... (Although the command does work from a web browser) .... Which brings up a very good question.... How should commands be entered??

I tried....

http://www.servername.com/smf/index.php?module=tRSSNews;sa=updatecache;func=cron;key=77a6dc1ac9364528

and I've tried the location on the server

/home/e-smith/files/ibays/directory/html/smf/index.php?module=tRSSNews;sa=updatecache;func=cron;key=77a6dc1ac9364528

I've even tried to start with "home" -  "/e-smith" - "e-smith" - "/files" and I still get... 

/bin/bash: "WHAT EVER PATH I USE"  ( No such file or directory )

I've even tried... /usr/bin/php -q home/e-smith/files/ibays/directory/html/smf/index.php?module=tRSSNews;sa=updatecache;func=cron;key=77a6dc1ac9364528

But I get "No input file specified"
« Last Edit: March 26, 2008, 05:02:36 PM by jklapp »

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: Big Cron Problem
« Reply #4 on: March 26, 2008, 06:00:48 PM »
I'm having a couple of big problems with cron... I setup a cron to run a script and this is what I keep getting in my mail box... (Of course I edited the server name :)
Perhaps you can try and explain what you are trying to achieve. To me it looks like you try to retrieve a URL from the bash shell/SME Server shell by entering the URL only. You probably receive an error as the shell is not able to interpret URLs, it has no way to handle it as it does not know what it is, you need extra programs for that.

I don't know why it's not working, the command line is correct...
It seems to me that your cron job is nothing more than a bash command, so everything you add in the bash file should also work from the SME server shell, did you actually try the command from the SME Server shell succesfully?

It would help if you would show us the code of the cronjob script as I have serious doubts that what you are doing is correct and should work like you state.

but this part is really strange... I deleted it in server-manager, but I keep getting the same error message in my mail box???
I do not know of any option to create cron jobs on stock SME Server, did you perhaps install a contrib that implements this?

(the message comes every minute) Any thoughts???
You probably set up the cron job to run every minute, as it fails every minute it will send you a mail every minute.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Big Cron Problem
« Reply #5 on: March 26, 2008, 07:05:46 PM »
Apparently the commands I entered into the cron server-manager was not correct...

The is no 'cron' page in server-manager.

Quote
I tried....

http://www.servername.com/smf/index.php?module=tRSSNews;sa=updatecache;func=cron;key=77a6dc1ac9364528

Ah, I see that you are trying to periodically access a URL, in order to activate some code in 'smf'. You could try:

Code: [Select]
wget -O /dev/null 'http://www.servername.com/smf/index.php?module=tRSSNews;sa=updatecache;func=cron;key=77a6dc1ac9364528'

I have some doubts that the 'key' parameter will stay valid, however. I suspect it's a session identifier, and will time out.

You're taking a rather unusual approach to this problem, whatever it is.



Offline jklapp

  • **
  • 32
  • +0/-0
Re: Big Cron Problem
« Reply #6 on: March 27, 2008, 03:00:16 AM »
There is no 'cron' page in server-manager.

Yes there is :) ... Check out http://wiki.contribs.org/Crontab_Manager


Quote
Ah, I see that you are trying to periodically access a URL, in order to activate some code in 'smf'. You could try:

Code: [Select]
wget -O /dev/null 'http://www.servername.com/smf/index.php?module=tRSSNews;sa=updatecache;func=cron;key=77a6dc1ac9364528'

I have some doubts that the 'key' parameter will stay valid, however. I suspect it's a session identifier, and will time out.

You're taking a rather unusual approach to this problem, whatever it is.

Your code work !!!Thank you :) ... I am though having a problem with that cron page in server-manager... I set it to update once a day and it's updating every minute. :(

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Big Cron Problem
« Reply #7 on: March 27, 2008, 04:04:16 AM »
Yes there is :) ... Check out http://wiki.contribs.org/Crontab_Manager

That is a contrib - it is not part of SME server.

Quote
I set it to update once a day and it's updating every minute. :(

I am quite sure that you have it set to update every minute. That's either your error, or it's a bug in the Crontab_Manager contrib. If you find it is the latter, then file a bug report against the contrib via the Bug Tracker.

Offline arne

  • *****
  • 1,116
  • +0/-4
Re: Big Cron Problem
« Reply #8 on: March 27, 2008, 11:48:02 PM »
Thanks a lot.

For a number of years I have had a file in the /etc/cron.hourly directory on the sme server and other Linux distroes.
It has been used to update a dynamic dns address with a file content like this: wget 'http://example.com/opdat.php'

It has worked all the time, but it has produced entries in the root directory that from time to time have had to be flushed out.

The only trix is to set the user rights for the file so that the file can be executed.

I guess the this small mod: "-O /dev/null" will mean something like "send output to device zero" and no more cleaning of the root directory.

I think that the most easy way to set up a cron job on most distroes is to just make a file with the cron job in the /etc/cron.hourly or the /etc/cron.daily directory.

Don't know if it is a recomended sme practice, but it har never given any problems (except for until now all the entries in the root directory.)

It's a okay and simple way to do it, is'n it ? (and the root user should be a ok file owner ?)
......

Offline arne

  • *****
  • 1,116
  • +0/-4
Re: Big Cron Problem
« Reply #9 on: March 28, 2008, 08:32:57 AM »
Works - Updates every hour and no more entries in the /root directory.
......