2

I am using the CentOS release 6.3 (Final).

My problem is that even I have logged in as a root to my centos server through ssh crontab command is not available to me .

I got the following when ever I am trying to access the crontab :

[root@cl-t102-433cl bin]# crontab -e
-bash: crontab: command not found

Next time to justify myself I tried :

[root@cl-t102-433cl bin]# locate cron | grep bin
/usr/bin/crontab
/usr/sbin/anacron
/usr/sbin/crond

[root@cl-t102-433cl bin]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

Here as per the above two commands everything is seems to fine but why crontab command is not available to me ?

5
  • What is the output of ls -l /usr/bin/crontab?
    – Hennes
    Mar 10, 2013 at 13:52
  • 1
    It is the out put >> ls: cannot access /usr/bin/crontab: No such file or directory, but I am able to see that file when ever I tried the locate command
    – neotam
    Mar 10, 2013 at 13:54
  • Is the cronie package installed? yum info cronie.
    – Daniel Beck
    Mar 10, 2013 at 13:57
  • Yes it is available(installed).
    – neotam
    Mar 10, 2013 at 14:02
  • 1
    When the command says available, that means it's not installed.
    – Daniel Beck
    Mar 10, 2013 at 14:10

1 Answer 1

3

ls: cannot access /usr/bin/crontab: No such file or directory

I am able to see that file when ever I tried the locate command

In that case crontab is not installed anymore.

Locate does not search the filesystem. It looks in a database which is usually generated once per day (often around 3AM). If the the contab binary was present when locate last updated itself then it will show up with locate. Even if it got removed afterward.

In your case something deleted the that file, or uninstalled the package responsive for crontab.

4
  • Do I need to install the cronie again .
    – neotam
    Mar 10, 2013 at 14:04
  • If you want to use it: yes. Try uninstalling it fully (yum uninstall packagename) and then 'yum install packagename`. (Or whatever package management tool you use. Might be rpm on CentOS.
    – Hennes
    Mar 10, 2013 at 14:07
  • Could you please explain me clearly about locate command or else give any link where I can find the stuff.
    – neotam
    Mar 10, 2013 at 14:08
  • The easiest analogy for locate is the index in a book. That index lists all the subjects and in which chapter or on which page they are discussed. Now if you edit that book then the index also needs to be updated. In your case a chapter from that book got removed, but the index still pointed to it. To update the index run updatedb. If you wish to search without using locate, use find.
    – Hennes
    Mar 10, 2013 at 14:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .