Find the answer to your Linux question:
Results 1 to 5 of 5
I am attempting to use the crontab command on a script that has this content: #!/bin/sh 0**** date>>log.txt 0**** w>>log.txt I am getting an error message that says "bad hour ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Nov 2002
    Posts
    420

    crontab error


    I am attempting to use the crontab command on a script that has this content:
    #!/bin/sh
    0**** date>>log.txt
    0**** w>>log.txt

    I am getting an error message that says "bad hour errors in crontab file, can't install." Is the syntax of my script incorrect, or do I have a problem with the crontab command?

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    You should seperate the time specification fields with whitespace.
    Also, although it doesn't hurt, since it's interpreted as a comment by crontab, it is in no way necessary to specify "#!/bin/sh" in a crontab file. To specift the shell, use "SHELL=/bin/sh", but /bin/sh is used by default anyway.

  3. #3
    Linux User
    Join Date
    Nov 2002
    Posts
    420

    crontab

    So crontab does not treat scripts independently?

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    No, it merges all the lines you enter into one big crontab (still one for each user, though).
    crontab(1) and crontab(5) have more info on the subject.

  6. #5
    Linux User
    Join Date
    Nov 2002
    Posts
    420

    thanks for the help!

    Thank you for taking the time to explain these things!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •