Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
hi.. im typing this into my terminal for a cron job Code: 37 9 * * 1-7 myusername /home/user/myshell but i get this error Code: bash: 37: command not found ...
  1. #1
    Linux Newbie usblackhawk's Avatar
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    241

    CRON error

    hi.. im typing this into my terminal for a cron job

    Code:
    37 9 * * 1-7 myusername /home/user/myshell
    but i get this error

    Code:
    bash: 37: command not found
    what am i doing wrong?

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    Use the whole path to the script since cron jobs may not provide the same working environment (path, aliases, etc.), for instance:

    Code:
    37 9 * * 1-7 /dir/of/the/script/myusername /home/user/myshell
    Regards

  3. #3
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    Sounds like you weren't in the editor. Did you issue this command before trying to add the cron job?

    Code:
    crontab -e

  4. #4
    Linux Newbie usblackhawk's Avatar
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    241
    Quote Originally Posted by vsemaska View Post
    Sounds like you weren't in the editor. Did you issue this command before trying to add the cron job?

    Code:
    crontab -e
    ok, so now i opened up crontab.... and i see a screen that says:
    Code:
    # m h  dom mon dow   command
    so i add my line underneath and press enter.. nothing happens... do i need to save it or something? i have never used cron so step by step help would be great thanks!

  5. #5
    Linux Enthusiast apoorv_khurasia's Avatar
    Join Date
    Feb 2005
    Location
    Laurasia
    Posts
    624
    I find the standard man pages quite informative.
    Code:
    man 5 crontab
    Or for a web-format goto:
    crontab(5)
    "There is no sixth rule"
    --Rob Pike
    Registered Linux User: 400426 home page

  6. #6
    Linux Newbie usblackhawk's Avatar
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    241
    am i write to understand that you write the cronjob in the crontab,.

    SAVE it..

    then in a standard terminal run the saved cronjob?

    im very confused.. i understand the syntax of cron, i just dont know how to execute or run it.

    im using the crontab, i type in my command.. but then nothign happens.. so im asusming a save needs to be made and then run in terminal.. or am i wrong.. please help!

  7. #7
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    Suppose you have your script at the location /home/mydir/ with the name myscript.
    Make your script is executable (chmod), type crontab -e and place the command:

    Code:
    15 15 * * 1-7 /home/mydir/myscript
    save the crontab and wait until 15:15 pm .
    That's all.

    Regards

  8. #8
    Linux Newbie usblackhawk's Avatar
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    241
    when u say save the script... do i just save it in my home directory... say if i call it mycron

    save it in: home/myuser/mycron

    just like that? and wait

  9. #9
    Linux Newbie usblackhawk's Avatar
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    241
    Quote Originally Posted by Franklin52 View Post
    Suppose you have your script at the location /home/mydir/ with the name myscript.
    Make your script is executable (chmod), type crontab -e and place the command:

    Code:
    15 15 * * 1-7 /home/mydir/myscript
    save the crontab and wait until 15:15 pm .
    That's all.

    Regards
    ok, i done exactly this:

    to test, i made it run 3 times in the space of 30min..

    using crontab -e i typed:

    Code:
    0 13 * * 1-7 /home/user/myshell
    15 13 * * 1-7 /home/user/myshell
    30 13 * * 1-7 /home/user/myshell
    then i saved this file in myuser directory and called it cronjob

    i made sure that myshell is executable using chmod.

    still nothing happens!???!?!??!

    there must be something that i am missing here!

  10. #10
    Linux Newbie usblackhawk's Avatar
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    241
    Quote Originally Posted by usblackhawk View Post
    still nothing happens!???!?!??!
    Fixed!. it works now! woohoo!! thanks for all your help! finaly after 2 dyas of messing around with cron! lol.

Page 1 of 2 1 2 LastLast

Posting Permissions

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