Centos 6 Crontab NOT runing
Dear all,
After moving to Centos 6, I'm detecting that my crontab is not running any way. I have copied the cron file from my old centos 5, and it's having the following: Quote:
When i try to run any of these commands in shel, they are working properly, but when I try to do ./crontab, I get, i.e: Quote:
What's going on? I'm googling into this, but all what i found is relating to install the cronie-anacron, which I already have, and up to date, and else, but nothing is working with me... Any idea, please!! |
Hi Ubunter
Although you didn't specify full path for your programs to get it running, you should: - check whether your #a2billing and php are in your path (PATH=/sbin:/bin:/usr/sbin:/usr/bin) - set full pathnames for running programs/scripts, like: Code:
service crond status good luck |
Hi lithos,
Im my OS, I have: Quote:
Then the perl and the php are properly there as: Quote:
But the users, root, it's the root itself, so the first lines should have no problem to get executed, as root, but it's showing also as command not found into: Quote:
Quote:
|
Now,
I don't know how are you trying to run crontab manually, but first is how you edit it ? Code:
# crontab -e then you copy into the file what you want. You make sure that it's enabled at startup And then you make sure which CRONTAB are you editing / using, because there's a system crontab at Code:
cat /etc/crontab Code:
# crontab -e |
Thanks again for your prompt lithos,
I have to re-edit my last post as I did the following now... First i removed the old crontab from etc. Then: As I don't like to use VI, and apparently the cron is not reading from nano, I made: Quote:
Quote:
Then: restart the crond, and cron -l and i see all my cron.. Make tail /var/log/cron, and it seem to be all fin working... I guess the error was coming from the nano, as i wrote the cron in /etc/crontab with nano. But, in my mail I still getting alerts as: Quote:
Quote:
Quote:
Quote:
Quote:
Thanks again for all :) Chears! |
Quote:
Code:
#a2billing You will best learn and solve if you know what you did wrong instead of someone writes you and you just copy/paste then. good luck |
Ok, you're write, sorry, I haven't thought about the nonlogin to run the cron...
But i just turn that crons to root, as i don't mind to run them as the user, or as root, and I still getting the same erros by mail as: Quote:
Quote:
|
Hi,
well, CentOS does not have "Run As " in the ROOT's crontab, it's in "/etc/crontab" take a look here, it will be much clearer what you're doing wrong. |
Quote:
As noboddy I can't run the crons, as this may make me problems into the system... I have deleted the a2billing user, and add the user as: useradd -M -s /sbin/ a2billing, but still getting the same command not found error... which i can't understand, why the root crons are not working also, as they are the default OS crons, as: Quote:
|
Hi,
I really don't know what is the cause and I would try to do it from scratch to see if working. BUT FIRST make a backup of your crontabs (root's and /etc) for example when 'root' you can do: Code:
# crontab -l >~/crontab-backup-04-2012 Code:
# cp -pv /etc/crontab /etc/crontab-backup-04-2012 Code:
# crontab -r Code:
# crontab -e Code:
SHELL=/bin/bash Then you can gradually proceed adding tasks to root's crontab. |
root’s crontab is not /etc/crontab. Only the latter has a six’th field for the user to be used to run this entry. Obviously it’s specified as “root”, but during execution treated like being the executing command.
|
Quote:
Code:
Until here all was fin, and now errors... Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Regards, |
Did you edit /etc/crontab or root’s crontab? Also please check man 5 crontab as the “%” has special meaning inside crontab and needs a special coding.
|
Quote:
Code:
*/1 * * * * touch /var/tmp/testfile-$(date +`date +%Y-%m-%d`) You can read more about Crontab. It will be helpful. Now onto your second problem with "command not found" Quote:
Code:
0 0 * * * root rm -rf /tmp/* and not in the root's or any other user's crontab (which you edit with "crontab -e")! The format in user's crontab CANNOT contain the column with the username and command to execute, because it's meant to run as the user who created its own crontab (with "crontab -e"). Now try please not putting the username in crontab just the command (this is the way to do it) otherwise you can use (in your root's crontab) sudo command to become other user and execute commands. Good luck |
Quote:
I'm doing and testing this since 2 days, the root crontab seem to be working, unless today i got this report by mail: Quote:
Quote:
The unique way, which I got it to work is to run the crons without user, into the root crontab as crontab -e I add the lines, and now, i see there log as running into the root, but not as custom /etc/crontab... I don't know if this is correct, it's working, but it's correct? |
All times are GMT -5. The time now is 05:52 PM. |