Article ID: 117699, created on Oct 3, 2013, last review on May 9, 2014

  • Applies to:
  • Virtuozzo containers for Linux

Symptoms

I try to run tmpwatch, but get message:

Not a directory: /etc/cron.hourly

Cause

if you check the file using the hexdump command, you will see the following:

CT-1979-bash-3.2# hexdump -C /etc/crontab

00000000  53 48 45 4c 4c 3d 2f 62  69 6e 2f 62 61 73 68 0d  |SHELL=/bin/bash.|
00000010  0a 50 41 54 48 3d 2f 73  62 69 6e 3a 2f 62 69 6e  |.PATH=/sbin:/bin|
00000020  3a 2f 75 73 72 2f 73 62  69 6e 3a 2f 75 73 72 2f  |:/usr/sbin:/usr/|
00000030  62 69 6e 0d 0a 4d 41 49  4c 54 4f 3d 52 4f 4f 54  |bin..MAILTO=ROOT|
00000040  0d 0a 48 4f 4d 45 3d 2f  0d 0a 0d 0a 23 20 72 75  |..HOME=/....# ru|
00000050  6e 2d 70 61 72 74 73 0d  0a 33 36 20 2a 20 2a 20  |n-parts..36 * * |
00000060  2a 20 2a 20 72 6f 6f 74  20 72 75 6e 2d 70 61 72  |* * root run-par|
00000070  74 73 20 2f 65 74 63 2f  63 72 6f 6e 2e 68 6f 75  |ts /etc/cron.hou|
00000080  72 6c 79 0d 0a 34 20 33  20 2a 20 2a 20 2a 20 72  |rly..4 3 * * * r|
00000090  6f 6f 74 20 72 75 6e 2d  70 61 72 74 73 20 2f 65  |oot run-parts /e|
000000a0  74 63 2f 63 72 6f 6e 2e  64 61 69 6c 79 0d 0a 32  |tc/cron.daily..2|
000000b0  35 20 31 20 2a 20 2a 20  30 20 72 6f 6f 74 20 72  |5 1 * * 0 root r|
000000c0  75 6e 2d 70 61 72 74 73  20 2f 65 74 63 2f 63 72  |un-parts /etc/cr|
000000d0  6f 6e 2e 77 65 65 6b 6c  79 0d 0a 31 38 20 34 20  |on.weekly..18 4 |
000000e0  31 39 20 2a 20 2a 20 72  6f 6f 74 20 72 75 6e 2d  |19 * * root run-|
000000f0  70 61 72 74 73 20 2f 65  74 63 2f 63 72 6f 6e 2e  |parts /etc/cron.|
00000100  6d 6f 6e 74 68 6c 79 0d  0a 30 20 2a 2f 38 20 2a  |monthly..0 */8 *|
00000110  20 2a 20 2a 20 72 6f 6f  74 20 2f 75 73 72 2f 73  | * * root /usr/s|
00000120  62 69 6e 2f 74 6d 70 77  61 74 63 68 20 2d 61 6d  |bin/tmpwatch -am|
00000130  20 31 30 20 2f 74 6d 70  0d 0a                    | 10 /tmp..|
0000013a

You will notice that every line of the file ends with '0d 0a'. This is the standard line ending in Windows. This results in run-parts reading /etc/cron.hourly\r instead of /etc/cron.hourly.

Resolution

There are two solutions possible:

  1. Re-create the file correctly, within the container.

  2. Fix the existing file using the following commands:

    # tr -d '\r' < /etc/crontab > /etc/crontab.fixed
    # mv -f /etc/crontab.fixed /etc/crontab 
    

Search Words

Not a directory: /etc/cron.hourly

e8e50b42231236b82df27684e7ec0beb 2897d76d56d2010f4e3a28f864d69223 d02f9caf3e11b191a38179103495106f

Email subscription for changes to this article
Save as PDF