Topic
  • 7 replies
  • Latest Post - ‏2008-06-30T14:41:23Z by SystemAdmin
SystemAdmin
SystemAdmin
47283 Posts

Pinned topic cron job and Clearcase

‏2008-06-30T09:52:48Z |
Hello everybody!
this is my first post.
What I want to do looks rather simple.
I simply want to create a new cron job in Solaris in order to build my project.
Manually, what I do is first to set my view in Clearcase: setview "myView"
Then I go to my directory; cd /myDir
And finally run the process command to build my project like; clearmake process

Now i want the above in one script:

#!/usr/bin/sh

cd /myDir

/usr/atria/bin/cleartool setview -exec "clearmake process" myView
The above runs perfectly when I'm doing it manually.
But when I create a cron job like:
  • * * * * /home/build.sh

it does nothing.

i know that cron runs in my machine since I have already tested it using an "echo".
But something does not allow the script to be run with Clearcase.

Any ideas?
Many thanks in advance
  • SystemAdmin
    SystemAdmin
    47283 Posts

    Re: cron job and Clearcase

    ‏2008-06-30T10:36:44Z  
    If MyDir is in ClearCase, it won't have been visible prior to setting a view, hence your script will fail to "cd" into it. It is also possible that "clearmake" isn't in your crontab's PATH.

    Regards,

    Kristijan
  • ThosRTanner
    ThosRTanner
    87 Posts

    Re: cron job and Clearcase

    ‏2008-06-30T12:08:16Z  
    /home/build.sh seems to be a somewhat unusual place to put the cron script. Shouldn't it be something like /home/whateveryournameis/build.sh ?

    Anyway, you'd normally get an email from cron when your job has been completed. What does that say?
  • SystemAdmin
    SystemAdmin
    47283 Posts

    RE: [cciug] cron job and Clearcase

    ‏2008-06-30T12:34:43Z  
    Test out your cron job script with a simpler ClearCase command like
    'cleartool lsvob' or 'clearool lsview ' with the output
    redirect to some log file.

    See if the log file captures the expected output.

    -----Original Message-----
    From: cciug-bounces@lists.ca.ibm.com
    mailto:cciug-bounces@lists.ca.ibm.com On Behalf Of Rational ClearCase
    Sent: Monday, June 30, 2008 5:53 AM
    To: cciug@lists.ca.ibm.com
    Subject: cciug cron job and Clearcase

    Hello everybody!

    this is my first post.

    What I want to do looks rather simple.

    I simply want to create a new cron job in Solaris in order to build my
    project.

    Manually, what I do is first to set my view in Clearcase: setview
    "myView"

    Then I go to my directory; cd /myDir

    And finally run the process command to build my project like; clearmake
    process

    Now i want the above in one script:

    #!/usr/bin/sh

    cd /myDir

    /usr/atria/bin/cleartool setview -exec "clearmake process" myView
    The above runs perfectly when I'm doing it manually.

    But when I create a cron job like:
    * * * * /home/build.sh

    it does nothing.

    i know that cron runs in my machine since I have already tested it using
    an "echo".

    But something does not allow the script to be run with Clearcase.

    Any ideas?

    Many thanks in advance
    _______________________________________________
    cciug mailing list
    cciug@lists.ca.ibm.com
    Unsubscribe:cciug-leave@lists.ca.ibm.com
  • SystemAdmin
    SystemAdmin
    47283 Posts

    Re: cron job and Clearcase

    ‏2008-06-30T12:37:27Z  
    Thanks for the answers.
    ThosRTanner, sorry for not claryfying it. I mean /home/build.sh is the same as /home/whateveryournameis/build.sh. Also, mail is not configured.

    chonky, the failure may be due to PATH. But how can I say to crontab about the PATH? If I edit the crontab and put in the first line PATH.... it will not be acceptable by Solaris.

    Thanks again.
  • ThosRTanner
    ThosRTanner
    87 Posts

    Re: cron job and Clearcase

    ‏2008-06-30T12:40:29Z  
    Thanks for the answers.
    ThosRTanner, sorry for not claryfying it. I mean /home/build.sh is the same as /home/whateveryournameis/build.sh. Also, mail is not configured.

    chonky, the failure may be due to PATH. But how can I say to crontab about the PATH? If I edit the crontab and put in the first line PATH.... it will not be acceptable by Solaris.

    Thanks again.
    Hmm. If you aren't configured for email, try putting

    
    (/home/xxxx/...) 1>/home/xxxx/cron_out 2>&1


    in your script.

    Also you can set the PATH like this:

    
    PATH=/usr/atria/bin:$PATH /home/xxxxx/.....
  • SystemAdmin
    SystemAdmin
    47283 Posts

    Re: cron job and Clearcase

    ‏2008-06-30T14:10:55Z  
    Thanks for the answers.
    ThosRTanner, sorry for not claryfying it. I mean /home/build.sh is the same as /home/whateveryournameis/build.sh. Also, mail is not configured.

    chonky, the failure may be due to PATH. But how can I say to crontab about the PATH? If I edit the crontab and put in the first line PATH.... it will not be acceptable by Solaris.

    Thanks again.
    As Thos already answered, you can set it explicitly in your crontab file. You can also set it in your shell script. And last but not least, you can execute commands using their absolute paths.

    Regards,

    Kristijan
  • SystemAdmin
    SystemAdmin
    47283 Posts

    Re: cron job and Clearcase

    ‏2008-06-30T14:41:23Z  
    Hmm. If you aren't configured for email, try putting

    <pre class="jive-pre"> (/home/xxxx/...) 1>/home/xxxx/cron_out 2>&1
    </pre>

    in your script.

    Also you can set the PATH like this:

    <pre class="jive-pre"> PATH=/usr/atria/bin:$PATH /home/xxxxx/.....
    </pre>
    Ok. Here you go.

    1. Cron script

    akashr65691r65691[~]$ cat /export/home/r65691/build.sh
    /opt/rational/clearcase/bin/cleartool setview -exec '/usr/bin/bash -c "source /export/home/r65691/.bashrc ; cd /vobs/play ; invob lb ; cleartool ls"' r65691_main_unix

    2. Crontab entry

    akashr65691r65691[~]$ crontab -l
    38 9 * * * /export/home/r65691/build.sh >/export/home/r65691/build.out 2>&1

    3. Cron Output

    akashr65691r65691[~]$ ls -l /export/home/r65691/build.out
    -rw-r--r-- 1 r65691 ccuser 664 Jun 30 09:38 /export/home/r65691/build.out
    akashr65691r65691[~]$ cat /export/home/r65691/build.out
    20060723.171831 BACKSTOP unlocked original@/vobs/play ccadm
    20060723.171831 CHECKEDOUT unlocked original@/vobs/play ccadm
    20060723.171831 LATEST unlocked original@/vobs/play ccadm
    20080624.061124 TEST1 unlocked original@/vobs/play r65691
    LnReadMe.txt --> ReadMe.txt
    ReadMe.txt@@/main/1 Rule: /main/LATEST
    lost+found@@/main/0 Rule: /main/LATEST

    Guru Ashok