autorep command(belongs to autosys) not executing in crontab. Why? [duplicate]












-2
















This question already has an answer here:




  • CronJob not running

    8 answers




Below is my cron entry:



#!/bin/bash
09 01 * * * /home/c/charlesp/jobs.sh > /home/c/charlesp/jobs1.log 2>&1


which gives me only the error output, but not the actual output for which the script is written. The script is working fine and giving desired output when it is executed directly, but not in cron. When it is running in crontab, the error given is below. Please help. The errors are only coming when I run them in cron; not outside of cron.



Errors:



1.When i give autorep command directly in the script:



/home/c/charlesp/jobs.sh: line 3: autorep: command not found


2.When i give autorep command along with absolute path in the script:



/opt/CA/WorkloadAutomationAE/autosys/bin/autorep: error while loading shared libraries: libascmn.so: cannot open shared object file: No such file or directory


My script is below:



Only autorep command:



#!/usr/local/bin/bash
autorep -j ALL -L0 | grep -w RU > /home/c/charlesp/jobs.txt


With absolute path :



#!/usr/local/bin/bash
/opt/CA/WorkloadAutomationAE/autosys/bin/autorep -j ALL -L0 | grep -w RU > /home/c/charlesp/jobs.txt









share|improve this question















marked as duplicate by Conner, tripleee bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 27 '18 at 7:49


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • By default, cron jobs run with a really minimal environment. You probably need to set PATH and LD_LIBRARY_PATH, and maybe other things. Some previous similar questions are here and here.

    – Gordon Davisson
    Nov 27 '18 at 5:59











  • Thanks Gordon. I resolved this via unix.com/shell-programming-and-scripting/… and comm.support.ca.com/kb/…

    – Prince Charu
    Nov 27 '18 at 7:05


















-2
















This question already has an answer here:




  • CronJob not running

    8 answers




Below is my cron entry:



#!/bin/bash
09 01 * * * /home/c/charlesp/jobs.sh > /home/c/charlesp/jobs1.log 2>&1


which gives me only the error output, but not the actual output for which the script is written. The script is working fine and giving desired output when it is executed directly, but not in cron. When it is running in crontab, the error given is below. Please help. The errors are only coming when I run them in cron; not outside of cron.



Errors:



1.When i give autorep command directly in the script:



/home/c/charlesp/jobs.sh: line 3: autorep: command not found


2.When i give autorep command along with absolute path in the script:



/opt/CA/WorkloadAutomationAE/autosys/bin/autorep: error while loading shared libraries: libascmn.so: cannot open shared object file: No such file or directory


My script is below:



Only autorep command:



#!/usr/local/bin/bash
autorep -j ALL -L0 | grep -w RU > /home/c/charlesp/jobs.txt


With absolute path :



#!/usr/local/bin/bash
/opt/CA/WorkloadAutomationAE/autosys/bin/autorep -j ALL -L0 | grep -w RU > /home/c/charlesp/jobs.txt









share|improve this question















marked as duplicate by Conner, tripleee bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 27 '18 at 7:49


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • By default, cron jobs run with a really minimal environment. You probably need to set PATH and LD_LIBRARY_PATH, and maybe other things. Some previous similar questions are here and here.

    – Gordon Davisson
    Nov 27 '18 at 5:59











  • Thanks Gordon. I resolved this via unix.com/shell-programming-and-scripting/… and comm.support.ca.com/kb/…

    – Prince Charu
    Nov 27 '18 at 7:05
















-2












-2








-2









This question already has an answer here:




  • CronJob not running

    8 answers




Below is my cron entry:



#!/bin/bash
09 01 * * * /home/c/charlesp/jobs.sh > /home/c/charlesp/jobs1.log 2>&1


which gives me only the error output, but not the actual output for which the script is written. The script is working fine and giving desired output when it is executed directly, but not in cron. When it is running in crontab, the error given is below. Please help. The errors are only coming when I run them in cron; not outside of cron.



Errors:



1.When i give autorep command directly in the script:



/home/c/charlesp/jobs.sh: line 3: autorep: command not found


2.When i give autorep command along with absolute path in the script:



/opt/CA/WorkloadAutomationAE/autosys/bin/autorep: error while loading shared libraries: libascmn.so: cannot open shared object file: No such file or directory


My script is below:



Only autorep command:



#!/usr/local/bin/bash
autorep -j ALL -L0 | grep -w RU > /home/c/charlesp/jobs.txt


With absolute path :



#!/usr/local/bin/bash
/opt/CA/WorkloadAutomationAE/autosys/bin/autorep -j ALL -L0 | grep -w RU > /home/c/charlesp/jobs.txt









share|improve this question

















This question already has an answer here:




  • CronJob not running

    8 answers




Below is my cron entry:



#!/bin/bash
09 01 * * * /home/c/charlesp/jobs.sh > /home/c/charlesp/jobs1.log 2>&1


which gives me only the error output, but not the actual output for which the script is written. The script is working fine and giving desired output when it is executed directly, but not in cron. When it is running in crontab, the error given is below. Please help. The errors are only coming when I run them in cron; not outside of cron.



Errors:



1.When i give autorep command directly in the script:



/home/c/charlesp/jobs.sh: line 3: autorep: command not found


2.When i give autorep command along with absolute path in the script:



/opt/CA/WorkloadAutomationAE/autosys/bin/autorep: error while loading shared libraries: libascmn.so: cannot open shared object file: No such file or directory


My script is below:



Only autorep command:



#!/usr/local/bin/bash
autorep -j ALL -L0 | grep -w RU > /home/c/charlesp/jobs.txt


With absolute path :



#!/usr/local/bin/bash
/opt/CA/WorkloadAutomationAE/autosys/bin/autorep -j ALL -L0 | grep -w RU > /home/c/charlesp/jobs.txt




This question already has an answer here:




  • CronJob not running

    8 answers








bash cron






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 27 '18 at 1:51









Conner

23.4k84568




23.4k84568










asked Nov 27 '18 at 1:45









Prince CharuPrince Charu

52




52




marked as duplicate by Conner, tripleee bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 27 '18 at 7:49


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Conner, tripleee bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 27 '18 at 7:49


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • By default, cron jobs run with a really minimal environment. You probably need to set PATH and LD_LIBRARY_PATH, and maybe other things. Some previous similar questions are here and here.

    – Gordon Davisson
    Nov 27 '18 at 5:59











  • Thanks Gordon. I resolved this via unix.com/shell-programming-and-scripting/… and comm.support.ca.com/kb/…

    – Prince Charu
    Nov 27 '18 at 7:05





















  • By default, cron jobs run with a really minimal environment. You probably need to set PATH and LD_LIBRARY_PATH, and maybe other things. Some previous similar questions are here and here.

    – Gordon Davisson
    Nov 27 '18 at 5:59











  • Thanks Gordon. I resolved this via unix.com/shell-programming-and-scripting/… and comm.support.ca.com/kb/…

    – Prince Charu
    Nov 27 '18 at 7:05



















By default, cron jobs run with a really minimal environment. You probably need to set PATH and LD_LIBRARY_PATH, and maybe other things. Some previous similar questions are here and here.

– Gordon Davisson
Nov 27 '18 at 5:59





By default, cron jobs run with a really minimal environment. You probably need to set PATH and LD_LIBRARY_PATH, and maybe other things. Some previous similar questions are here and here.

– Gordon Davisson
Nov 27 '18 at 5:59













Thanks Gordon. I resolved this via unix.com/shell-programming-and-scripting/… and comm.support.ca.com/kb/…

– Prince Charu
Nov 27 '18 at 7:05







Thanks Gordon. I resolved this via unix.com/shell-programming-and-scripting/… and comm.support.ca.com/kb/…

– Prince Charu
Nov 27 '18 at 7:05














1 Answer
1






active

oldest

votes


















0














As stated by Gordon, cron run with a minimal environment.



For Error 1:
First of all, we need to use absolute paths for everything in the script which we keep as cron entry. So complete path is given in the script like below.



/opt/CA/WorkloadAutomationAE/autosys/bin/autorep -j ALL -L0 | grep -w RU > /home/c/charlesp/jobs.txt



Got error 2 here.



For Error 2:
Since libascmn.so is unavailable, we need to export that path where libascmn.so is present to LD_LIBRARY_PATH like below.



-bash-4.3$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/CA/WorkloadAutomationAE/autosys/lib



Got error 3 here.



For Error 3:



Below is the error:



Resource bundle is not available while looking for key="CAUAJM_E_80003".



For this, we need to source the environment of autosys like below.



-bash-4.3$ . /opt/CA/WorkloadAutomationAE/autouser.TQ1/autosys.sh.automgmtq1



Now, even if it does not work with .sh script, change it to .csh script.



Now the script will work like a charm in Cron.



Thank You. :)






share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    As stated by Gordon, cron run with a minimal environment.



    For Error 1:
    First of all, we need to use absolute paths for everything in the script which we keep as cron entry. So complete path is given in the script like below.



    /opt/CA/WorkloadAutomationAE/autosys/bin/autorep -j ALL -L0 | grep -w RU > /home/c/charlesp/jobs.txt



    Got error 2 here.



    For Error 2:
    Since libascmn.so is unavailable, we need to export that path where libascmn.so is present to LD_LIBRARY_PATH like below.



    -bash-4.3$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/CA/WorkloadAutomationAE/autosys/lib



    Got error 3 here.



    For Error 3:



    Below is the error:



    Resource bundle is not available while looking for key="CAUAJM_E_80003".



    For this, we need to source the environment of autosys like below.



    -bash-4.3$ . /opt/CA/WorkloadAutomationAE/autouser.TQ1/autosys.sh.automgmtq1



    Now, even if it does not work with .sh script, change it to .csh script.



    Now the script will work like a charm in Cron.



    Thank You. :)






    share|improve this answer




























      0














      As stated by Gordon, cron run with a minimal environment.



      For Error 1:
      First of all, we need to use absolute paths for everything in the script which we keep as cron entry. So complete path is given in the script like below.



      /opt/CA/WorkloadAutomationAE/autosys/bin/autorep -j ALL -L0 | grep -w RU > /home/c/charlesp/jobs.txt



      Got error 2 here.



      For Error 2:
      Since libascmn.so is unavailable, we need to export that path where libascmn.so is present to LD_LIBRARY_PATH like below.



      -bash-4.3$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/CA/WorkloadAutomationAE/autosys/lib



      Got error 3 here.



      For Error 3:



      Below is the error:



      Resource bundle is not available while looking for key="CAUAJM_E_80003".



      For this, we need to source the environment of autosys like below.



      -bash-4.3$ . /opt/CA/WorkloadAutomationAE/autouser.TQ1/autosys.sh.automgmtq1



      Now, even if it does not work with .sh script, change it to .csh script.



      Now the script will work like a charm in Cron.



      Thank You. :)






      share|improve this answer


























        0












        0








        0







        As stated by Gordon, cron run with a minimal environment.



        For Error 1:
        First of all, we need to use absolute paths for everything in the script which we keep as cron entry. So complete path is given in the script like below.



        /opt/CA/WorkloadAutomationAE/autosys/bin/autorep -j ALL -L0 | grep -w RU > /home/c/charlesp/jobs.txt



        Got error 2 here.



        For Error 2:
        Since libascmn.so is unavailable, we need to export that path where libascmn.so is present to LD_LIBRARY_PATH like below.



        -bash-4.3$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/CA/WorkloadAutomationAE/autosys/lib



        Got error 3 here.



        For Error 3:



        Below is the error:



        Resource bundle is not available while looking for key="CAUAJM_E_80003".



        For this, we need to source the environment of autosys like below.



        -bash-4.3$ . /opt/CA/WorkloadAutomationAE/autouser.TQ1/autosys.sh.automgmtq1



        Now, even if it does not work with .sh script, change it to .csh script.



        Now the script will work like a charm in Cron.



        Thank You. :)






        share|improve this answer













        As stated by Gordon, cron run with a minimal environment.



        For Error 1:
        First of all, we need to use absolute paths for everything in the script which we keep as cron entry. So complete path is given in the script like below.



        /opt/CA/WorkloadAutomationAE/autosys/bin/autorep -j ALL -L0 | grep -w RU > /home/c/charlesp/jobs.txt



        Got error 2 here.



        For Error 2:
        Since libascmn.so is unavailable, we need to export that path where libascmn.so is present to LD_LIBRARY_PATH like below.



        -bash-4.3$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/CA/WorkloadAutomationAE/autosys/lib



        Got error 3 here.



        For Error 3:



        Below is the error:



        Resource bundle is not available while looking for key="CAUAJM_E_80003".



        For this, we need to source the environment of autosys like below.



        -bash-4.3$ . /opt/CA/WorkloadAutomationAE/autouser.TQ1/autosys.sh.automgmtq1



        Now, even if it does not work with .sh script, change it to .csh script.



        Now the script will work like a charm in Cron.



        Thank You. :)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 27 '18 at 7:28









        Prince CharuPrince Charu

        52




        52

















            Popular posts from this blog

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

            Calculate evaluation metrics using cross_val_predict sklearn

            Insert data from modal to MySQL (multiple modal on website)