#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2006
    Posts
    6
    Rep Power
    0

    Setting Up Cron job on AIX


    I need assistance on creating a cron job on Aix Unix that will run a batch job at an interval of 10 minutes everyday.

    Getting the cron job, will save me from telneting into the server , cahanging to the path before running the batch job at prompt every time.

    I will appreciate immediate response from anyone because I need to deliver this assignment this week.

    Thank you
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    210
    Rep Power
    27
    PHP Code:
    crontab -
    That'll get you into edit mode for your crontab. Then, just insert the timing and job options:

    PHP Code:
    00,10,20,30,40,50 * * * * /path/to/script 
    That should do it. You need to be familiar with the vi editor to modify your crontab. Unless you've configured your system for a different default editor.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2006
    Posts
    6
    Rep Power
    0
    Thank you. I have try what you suggested but, the cron job is not running.

    I tried running the script at command line and it is responding but the cron is not running as specified.

    please what else can I do to get this cron job working.


    Thank you
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Location
    Dublin, Ireland
    Posts
    174
    Rep Power
    45
    Is the cron daemon running?

    Code:
    # ptree | grep cron
                22652 grep cron
    409   /usr/sbin/cron
    I'm not sure if ptree is available on AIX, I guess you could use ps though

    Code:
    # ps -aef | grep cron
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2006
    Posts
    6
    Rep Power
    0
    I have run the comand

    ps -aef |grep cron


    the result is ...


    root 24278 1 0 Jul 28 - 0:09 /usr/sbin/cron
    cdci 40916 16782 1 18:30:06 pts/1 0:00 grep cron


    This shows that the cron is running.


    May be I need to give more detail of what I want to achieve.

    First,

    I have a script called atm, this script is to monitor some processes . I want this script to now be run at an interval of 10mins everyday.

    I want the output from this script to be displayed automatically on the VDU each time the cron job is run.

    I created two additional files, a text file and another scripts that is called monitor, the content is thus

    ./atm>>view

    then I now use

    tail -f view

    crontab -e

    00,10,20,30,40,50 * * * /akin/cdci/CBC/cbc/log/monitor


    I use tail to view the result of the cron tab, but this is not running., But running the script at command line gives the result.

    I hope with this is detail, that I will able to get more assistance.

    Thank you
  10. #6
  11. funky munky
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2001
    Location
    UK
    Posts
    1,446
    Rep Power
    16
    Some things to check:

    1. Check the cron log to see if the script ran or not - /var/log/cron on freebsd, varies from OS to OS though (just noticed you say AIX in the title of the post - maybe try /var/adm/cron/log?

    2. Ensure any filenames inside the 'monitor' script use absolute pathnames - cron runs with a limited PATH so might not find any commands if you use a short executable name - ie use '/usr/local/bin/some_proggie' instead of just 'some_proggie'.

    3. Check you mail to see if any error messages were displayed when cron tried to run the script. Cron usually directs any errors to the mail account of the user the job is running as.

    Also note you can shorten

    00,10,20,30,40,50

    to

    */10

    to run the script every 10 minutes.

    The man pages for cron and crontab can be very helpful too
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2008
    Posts
    2
    Rep Power
    0

    Question Every x minutes for AIX?


    Originally Posted by munkfish
    Also note you can shorten
    00,10,20,30,40,50
    to
    */10
    to run the script every 10 minutes.
    */10 doesn't work on AIX

    Does anyone know how to run something from cron every x minutes (or whatever interval of time) on AIX? I had a script I wanted to run every 50 hours and tried */50 and it crabbed at me...

    A line of the crontab file:
    * */50 * * * /registry/safeapp/logs/check.ksh rg_rmsguid

    contains the following error:
    0481-079 Reached a symbol that is not expected.

    Thanks for any input!
    Kat
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2009
    Posts
    1
    Rep Power
    0
    Please try like this

    0,30 * * * * script name

    this will run the script every 30 minutes , you just have to seperate with comma for every x minutes
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2006
    Posts
    2,449
    Rep Power
    1751
    18 months late, but thanks!
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo