Find the answer to your Linux question:
Results 1 to 10 of 10
Dear Group, I am trying to execute my shell script through cron on RedHat Linux 9.0, which will compile a set of files, but cron is not responding properly. I ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    7

    Unhappy CRON is not reponding properly

    Dear Group,

    I am trying to execute my shell script through cron on RedHat Linux 9.0, which will compile a set of files, but cron is not responding properly. I have configured crontab to run the batchtx script for every 2 minuts as below:

    */2 * * * * root /data/jay/batch/batchtx

    but nothing happened so far. Please suggest how to run the script through cron.

    ...Jay

  2. #2
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    Looks like a typo, you forgot the '/' before 'root'.

    You can check /var/log/cron to see if it runs.

    Vic

  3. #3
    Just Joined!
    Join Date
    Aug 2007
    Posts
    37
    To run the script every 2 minutes your crontab should look like this:
    Code:
    #minute    hour      day-of-month  month     day-of-week  user  command
    #(0 - 59)  (0 - 23)  (1 - 31)      (1 - 12)  (0 - 7)        
    2          *         *             *         *            root  /data/jay/batch/batchtx

  4. #4
    Just Joined!
    Join Date
    Sep 2007
    Posts
    7
    Thanks for correcting me. However, after correction, script is still not running. I have copied cron log file for your perusal.

    Sep 6 18:28:00 172 CROND[3799]: (root) CMD (/bin/sh /data/jay/batch/batchtx /data/jay/batch/batchtx.log)

    But the long file in empty (0 k size). Please suggest.

    ...Jay

  5. #5
    Just Joined!
    Join Date
    Aug 2007
    Posts
    37
    Sorry, I don't know very much about cron. I think that on some systems, after you have edited the crontab file you have to run the command:
    Code:
    crontab /etc/crontab
    for the changes to take effect.

  6. #6
    Linux User
    Join Date
    Jun 2007
    Posts
    318
    jay2708,

    How did you enter that crontab entry? Was it with the 'crontab -e' command?

    Looking at that cron log entry it seems to me you didn't conpletely list the entry crontab entry. You specified a log file but don't have the correct syntax. This is what I see the crontab entry should be:

    */2 * * * * /data/jay/batch/batchtx > /data/jay/batch/batchtx.log 2>&1

    If it doesn't work specify the minutes as a range:

    0-59/2 * * * * /data/jay/batch/batchtx > /data/jay/batch/batchtx.log 2>&1

    joyba,

    Your crontab entry example would run the script 2 minutes after the hour and not every 2 minutes. Also you the 'crontab /etc/crontab' example is wrong. That file defines the what should run hourly, daily, weekly, & monthly.

  7. #7
    Just Joined!
    Join Date
    Aug 2007
    Posts
    37
    Ooops, sorry. I should have left this question to someone with more knowledge.

  8. #8
    Just Joined!
    Join Date
    Sep 2007
    Posts
    7
    Dear Group:

    I am using the mention below script for batch compilation of TeX files :

    #!/bin/sh

    for file in *.tex
    do
    /usr/local/texlive/2007/bin/i386-linux/latex "\scrollmode\input $file"
    case $? in
    0) for f in *.dvi; do /usr/local/texlive/2007/bin/i386-linux/dvips -ta4 $f; done && mv "${file%.*}".{tex,ps} ../success/ ;;
    *) mv "${file%.*}".{tex,dvi,log} ../failure/ ;;
    esac
    #
    rm -f *.aux
    rm -f *.dvi
    rm -f "${file%.*}".log
    #
    done
    ############### Remove duplicate files #########################
    for i in ../failure/*
    do
    filename=`basename $i`
    if [[ -f ../success/$filename ]]; then
    rm ../success/$filename
    fi
    done
    ################################################## #####

    When I am running ./batchtx command its working fine, but I am trying to run through cron, I getting batchtx.log file as below:

    This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6)
    %&-line parsing enabled.
    entering extended mode
    LaTeX2e <2005/12/01>
    Babel <v3.8h> and hyphenation patterns for english, usenglishmax, dumylang, noh
    yphenation, arabic, basque, bulgarian, coptic, welsh, czech, slovak, german, ng
    erman, danish, esperanto, spanish, catalan, galician, estonian, farsi, finnish,
    french, greek, monogreek, ancientgreek, croatian, hungarian, interlingua, ibyc
    us, indonesian, icelandic, italian, latin, mongolian, dutch, norsk, polish, por
    tuguese, pinyin, romanian, russian, slovenian, uppersorbian, serbian, swedish,
    turkish, ukenglish, ukrainian, loaded.

    ! I can't find file `*.tex'.
    <*> \scrollmode\input *.tex

    Please type another input file name:
    ! Emergency stop.
    <*> \scrollmode\input *.tex

    No pages of output.
    Transcript written on texput.log.
    mv: when moving multiple files, last argument must be a directory
    Try `mv --help' for more information.


    Please correct my script to get the desired output. My cron script is:

    */2 * * * * /bin/sh /data/jay/batch/batchtx > /data/jay/batch/batchtx.log 2>&1

    Please help.

    ...Jay

  9. #9
    Just Joined!
    Join Date
    Aug 2007
    Posts
    37
    The error message says that latex can't find your tex files.

    At the beginning of your script cd to the directory that you want to work in:
    Code:
    cd /full/path/to/tex/files

  10. #10
    Just Joined!
    Join Date
    Sep 2007
    Posts
    7
    It is working fine now. Thanks for your support.

    ...Jay

Posting Permissions

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