Results 1 to 8 of 8

Thread: cron makes me grabby

  1. #1
    Join Date
    Dec 2009
    Location
    germany
    Beans
    1,020
    Distro
    Ubuntu 12.04 Precise Pangolin

    cron makes me grabby

    i am running ubuntu 12.04
    what i have done (in my useraccount) is:
    crontab -e
    insert the following line
    2 * * * * /home/richi/tmp/my_id

    the script is owned by me and is executable

    the file in /var/spool/crontabs was created
    ls -l /var/spool/cron/crontabs
    -rw------- 1 richi crontab 1124 Nov 16 17:12 richi

    but the result is that the script is running only every hour (looks like cron.hourly - but this directory is empty)

    i also tried /etc/cron.allowd -> no change - cron is running only every hour.
    whats going on ?
    "What is the robbing of a bank compared to the FOUNDING of a bank?" Berthold Brecht

  2. #2
    Join Date
    May 2006
    Location
    Milwaukee,WI
    Beans
    6,111
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: cron makes me grabby

    how often do you want it to run? and what is within the script?
    Check out my Blog about my life and computer software and hardware. http://ubuntuaddicted.blogspot.com/
    My YouTube channel:
    http://www.youtube.com/ubuntuaddicted

  3. #3
    Join Date
    Dec 2009
    Location
    germany
    Beans
    1,020
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: cron makes me grabby

    Quote Originally Posted by dannyboy79 View Post
    how often do you want it to run? and what is within the script?
    hello
    it is just a test for me and i want to run it only 3 or 4 times.
    the contens of the script is:

    /usr/bin/id -a >>/home/richi/tmp/my_id.txt
    /bin/date >> /home/richi/tmp/my_id.txt

    and the permissions are:
    ls -l my_id
    -rwxr-xr-x 1 richi richi 82 Nov 16 16:09 my_id

    by the side i ain't change anything in the configuration
    "What is the robbing of a bank compared to the FOUNDING of a bank?" Berthold Brecht

  4. #4
    Join Date
    May 2006
    Location
    Milwaukee,WI
    Beans
    6,111
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: cron makes me grabby

    have you successfully ran the script from the command line?

    i believe you need
    Code:
    #!/bin/bash
    at the top of your script. also, what do you mean you want to run it 3 or 4 times? crontab needs specifics for how often you want to run it, whether it's once every 30 minutes or once every 10 minutes or what.
    Check out my Blog about my life and computer software and hardware. http://ubuntuaddicted.blogspot.com/
    My YouTube channel:
    http://www.youtube.com/ubuntuaddicted

  5. #5
    Join Date
    Apr 2006
    Location
    Ubuntuland
    Beans
    2,124
    Distro
    Ubuntu 13.10 Saucy Salamander

    Lightbulb Re: cron makes me grabby

    Your cron job is set to run once an hour on the second minute of the hour. What did you expect?

    man cron
    24 beers in a case, 24 hours in a day. Coincidence? I think not!

    Trusty Tahr 64 bit, AMD Phenom II 955 Quad Core 3.2GHz, GeForce 9600 GT
    16G PC2-6400 RAM, 128 GB SSD, Twin 1TB SATA 7200 RPM RAID0

  6. #6
    Join Date
    Nov 2012
    Beans
    9

    Re: cron makes me grabby

    As has been said, your cron is set to run on the second minute of every hour. If you want it to run every 2 minutes or whatever, you would use a configuration like this

    Code:
    */2 * * * * /home/richi/tmp/my_id

  7. #7
    Join Date
    Dec 2009
    Location
    germany
    Beans
    1,020
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: cron makes me grabby

    Quote Originally Posted by Slim Odds View Post
    Your cron job is set to run once an hour on the second minute of the hour. What did you expect?

    man cron
    here is the output of my script:

    uid=1000(richi) gid=1000(richi) Gruppen=1000(richi),4(adm),24(cdrom),27(sudo),30(d ip),46(plugdev),109(lpadmin),124(sambashare)
    Fr 16. Nov 17:02:01 CET 2012
    uid=1000(richi) gid=1000(richi) Gruppen=1000(richi),4(adm),24(cdrom),27(sudo),30(d ip),46(plugdev),109(lpadmin),124(sambashare)
    Fr 16. Nov 18:02:01 CET 2012
    r
    and here is the entry in my crontab:
    2 * * * * /home/richi/tmp/my_id

    and i expected that means every two minutes and i want to have it run every two minutes ( just for testing)
    what is my mistake ?
    "What is the robbing of a bank compared to the FOUNDING of a bank?" Berthold Brecht

  8. #8
    Join Date
    Dec 2009
    Location
    germany
    Beans
    1,020
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: cron makes me grabby

    Quote Originally Posted by VooDooSyxx View Post
    As has been said, your cron is set to run on the second minute of every hour. If you want it to run every 2 minutes or whatever, you would use a configuration like this

    Code:
    */2 * * * * /home/richi/tmp/my_id
    ups
    the error was between my ears. haven't use cron since years.
    thanks
    i already call: crontab -r
    "What is the robbing of a bank compared to the FOUNDING of a bank?" Berthold Brecht

Tags for this Thread

Bookmarks

Posting Permissions

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