![]() |
Cronjob help please
0,30 * * * * /var/www/virtual/domain.com/htdocs/catcher
thatsd what i have. not working. catcher is a script that i want to run every 30 minutes. i chmod the script to 755 already... can anyone help... #!/bin/sh #start cd /var/www/virtual/domain.com/htdocs wget http://www.domain.net/master.txt cat /var/www/virtual/domain.com/htdocs/master.txt >> /var/www/virtual/domain.com/htdocs/mastercomp.txt #end thats the script i need to run. basically it pulls a .txt from a location and appends the mastercomp.txt any help appreciated.... |
bump init.d....
|
bump sudo su -.....
|
|
one last bump... :(
|
what do your cron logfiles say? check /var/log/cron (or similar location on your system). this will tell you whether it is a problem with the script itself, or what.
does the script run and work correctly when you run it by hand? |
./catcher: /bin/sh^M: bad interpreter: No such file or directory
thats what i just got when i tried to run it manuelly.... |
Mostly a lurker, but figured id help.
30 * * * * /path/whateveryouwanttorun Will run that script every 30 minutes. Remove that 0, you have. Goes min, hour, day of month, month, day of week. |
If i'm not mistaken, the 30 alone means it will run at :30 of every hour, day, etc. His intention seems originally to run it every half hour, meaning at :00 and :30.
also, the message "bad interpreter: No such file or directory" in this situation usually means you don't have that shell installed. Try putting /bin/bash instead and see if it runs manually then. Some systems just don't have the original Bourne shell installed anymore. |
Sorry, hes right. take 4:30am advice for what it is. Your original cron will run every 30 minutes.
problem is just your shell.. see if its even there, most likely just linked to bash. swap or fix, should be fine then. |
Quote:
|
/bash is in /bin and /sh is linked to /bash....
|
is it possible that i need to drop the script in cgi-bin or outside of htdocs?
|
the first line in the script is often called the "bang line", and it points to the shell used to execute the script. if the two shell location paths you have tried so far (/bin/sh and /bin/bash) don't work, you need to determine which shells are available to be used, and where they are located on your system.
check other existing working scripts on the same system to determine the shell they are using, and then try using the same shell and location in your script here. |
thanks for all your help guys.. it was the script. i uploaded it from my box and it was seeing it incorrectly. i manually added the script through vi and its working now... :thumbsup
|
An easy fix would be to change your cron line to this:
0,30 * * * * sh /var/www/virtual/domain.com/htdocs/catcher |
Ah, so the real problem was probably hidden line break characters then... What are you using to edit files?
|
Quote:
|
I could help you but I won't.
|
Quote:
Textpad will save the files in windows format wich uses ^M for carriage returns. Since linux/unix doesnt recognize ^M as a carriage return it will give you problems. Most linux distros usually come with two handy little tools for this situation.. remember these:) dos2unix unix2dos |
All times are GMT -7. The time now is 03:04 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123