Results 1 to 5 of 5

Thread: SOME COMMAND IN SHELL SCRIPT DOES NOT RUN IF STARTED BY CRON

  1. #1
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,032

    Default SOME COMMAND IN SHELL SCRIPT DOES NOT RUN IF STARTED BY CRON

    Hello.
    I am testing the following under root account
    I have written a shell script which is in /root/bin directory.
    The scrpit is named : test_temp
    This script use nvclock program to get actual temperature and then fix the fan speed accordingly using nvclock function. By the way the script put a line in my log file /var/log/test_temp.log

    Starting this shell script from a terminal and from any directory, in root session, run perfectly.
    It manage correctly the fan speed and put good informations in my log file.

    In crontab, I have set this line :

    */5 * * * * root /root/bin/test_temp >/dev/null 2>&1

    Effectively :
    1°) the script is run every five minutes ( timestamp in /var/log/test_temp.log).
    2°) good information are put in my log file /var/log/test_temp.log
    3°) I get the following message in /var/log/message every five minutes (rsyslog timestamp) :
    ==>>> 2011-05-23T23:40:01.613326+02:00 {linux-srv} {SVRTY: 6} {TAG: /usr/sbin/cron[12234]:}
    ....{MSG:} (root) CMD ( /root/bin/test_temp >/dev/null 2>&1)
    4°) the call to nvclock function have no effect. Fanspeed is unchanged.


    following the thread :
    cron job not running because of pam?

    I have changed /etc/pam.d/cron to :

    auth required pam_rootok.so
    account required pam_localuser.so
    session required pam_loginuid.so

    with no effect.
    Thanks for helping. JCD
    __________
    server leap 15.0 -- ASUS g75vw KDE leap 15.0 -- ASUS g750JZ Optimus KDE leap 15.1 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: SOME COMMAND IN SHELL SCRIPT DOES NOT RUN IF STARTED BY CRON

    What is the path to the nvclock program?

  3. #3
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,032

    Default Re: SOME COMMAND IN SHELL SCRIPT DOES NOT RUN IF STARTED BY CRON

    Quote Originally Posted by ken_yap View Post
    What is the path to the nvclock program?
    /usr/local/bin

    and the file is 755

    In the script, I have not put any path to the file. I am trying the call with /usr/local/bin/nvclock.
    Thanks for helping. JCD
    __________
    server leap 15.0 -- ASUS g75vw KDE leap 15.0 -- ASUS g750JZ Optimus KDE leap 15.1 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

  4. #4
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: SOME COMMAND IN SHELL SCRIPT DOES NOT RUN IF STARTED BY CRON

    Yes, do that. Usually cron jobs have a short $PATH which does not include /usr/local/bin.

  5. #5
    Join Date
    Jun 2008
    Location
    South-West France
    Posts
    1,032

    Default Re: SOME COMMAND IN SHELL SCRIPT DOES NOT RUN IF STARTED BY CRON

    Quote Originally Posted by ken_yap View Post
    What is the path to the nvclock program?
    You put your finger on it.
    Have put the full path in the script and then cron run correctly.


    Thanks for helping. JCD
    __________
    server leap 15.0 -- ASUS g75vw KDE leap 15.0 -- ASUS g750JZ Optimus KDE leap 15.1 -- acer aspire s13 win 10 home -- HP Omen win 10 home - scan EPSON V500 - Brother HL2250DN - Samsung CLP-325W

Posting Permissions

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