Page 1 of 5 123 ... LastLast
Results 1 to 10 of 48

Thread: cron job not running

  1. #1
    Ski K2 NNTP User

    Default cron job not running


    11.1 64 bit

    Can anyone tell me why this cron job is not running?

    The script runs fine from the users shell prompt.

    crontab -e

    # (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie
    Exp $)
    1 16 * * * sh /home/pathp/Navicat/start_navicat /schedule "Rack 5 to
    Local All"

    ???


    --
    Ski_K2
    ------------------------------------------------------------------------
    Ski_K2's Profile: http://forums.opensuse.org/member.php?userid=6818
    View this thread: http://forums.opensuse.org/showthread.php?t=404918


  2. #2
    ken yap NNTP User

    Default Re: cron job not running


    If you had any commands in the shell script "schedule" that depended on
    your $PATH or $HOME, they would fail to run.

    You should have received email containing any output from the job. Have
    you looked for the email?


    --
    ken_yap
    ------------------------------------------------------------------------
    ken_yap's Profile: http://forums.opensuse.org/member.php?userid=221
    View this thread: http://forums.opensuse.org/showthread.php?t=404918


  3. #3
    Ski K2 NNTP User

    Default Re: cron job not running


    I have not looked for email.

    I'll do that.

    Thanks


    --
    Ski_K2
    ------------------------------------------------------------------------
    Ski_K2's Profile: http://forums.opensuse.org/member.php?userid=6818
    View this thread: http://forums.opensuse.org/showthread.php?t=404918


  4. #4
    ab@novell.com NNTP User

    Default Re: cron job not running

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Agreed.... start by changing 'sh' to '/bin/sh' (or '/bin/bash') just to
    be sure, and then also check for that e-mail. The /var/log/messages
    file should also have output from when it was attempted (if it was
    attempted). Set to '* * * * *' for testing, or something that runs
    more-often than once per day.

    Good luck.





    ken yap wrote:
    > If you had any commands in the shell script "schedule" that depended on
    > your $PATH or $HOME, they would fail to run.
    >
    > You should have received email containing any output from the job. Have
    > you looked for the email?
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.2 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iD8DBQFJbfK73s42bA80+9kRAkqbAJ9DaUFxKtPMXjQoCyox5gY3zYXE0ACfTOz4
    B2LM3l/rmE4buMlGvoFnFGg=
    =z5zh
    -----END PGP SIGNATURE-----

  5. #5
    Ski K2 NNTP User

    Default Re: cron job not running


    ken_yap;1927067 Wrote:
    > If you had any commands in the shell script "schedule" that depended on
    > your $PATH or $HOME, they would fail to run.
    >
    > You should have received email containing any output from the job. Have
    > you looked for the email?


    If, during my Suse install, I ticked the box to receive system mail
    where would I find it?

    I don't have a /var/log/mail.

    The script does use $HOME and other system variables but if the script
    runs OK at this users shell then why would the users crontab not run it
    OK?


    --
    Ski_K2
    ------------------------------------------------------------------------
    Ski_K2's Profile: http://forums.opensuse.org/member.php?userid=6818
    View this thread: http://forums.opensuse.org/showthread.php?t=404918


  6. #6
    Ski K2 NNTP User

    Default Re: cron job not running


    I'll try /bin/sh

    Thanks ab


    --
    Ski_K2
    ------------------------------------------------------------------------
    Ski_K2's Profile: http://forums.opensuse.org/member.php?userid=6818
    View this thread: http://forums.opensuse.org/showthread.php?t=404918


  7. #7
    ken yap NNTP User

    Default Re: cron job not running


    The mail goes to /var/mail/<user>.

    If you didn't have postfix running the mail might have been lost. You
    can capture the output of the cron job by appending

    > /tmp/schedule.log 2>&1


    to the line.

    In a cron job, various variables that are set in a normal interactive
    session are not. There is no $HOME because there is no login. And $PATH
    will be the system default.


    --
    ken_yap
    ------------------------------------------------------------------------
    ken_yap's Profile: http://forums.opensuse.org/member.php?userid=221
    View this thread: http://forums.opensuse.org/showthread.php?t=404918


  8. #8
    Ski K2 NNTP User

    Default Re: cron job not running


    ken_yap;1927513 Wrote:
    > The mail goes to /var/mail/<user>.
    >
    > If you didn't have postfix running the mail might have been lost. You
    > can capture the output of the cron job by appending
    >
    > > /tmp/schedule.log 2>&1

    >
    > to the line.
    >
    > In a cron job, various variables that are set in a normal interactive
    > session are not. There is no $HOME because there is no login. And $PATH
    > will be the system default.


    /bin/sh doesn't seem to run either.

    Changing the crontab entry to

    25 17 * * *
    /home/pathp/Navicat/start_navicat /schedule "Rack 5 to Local All"

    gets it to appear in var/log/messages calling the script but it does
    not run. Perhaps due to the missing variables?

    This same script ran fine in 10.3 using a native linux version of this
    application.

    The current version running is a winblows app running using wine

    Here's a copy of the script


    Code:
    --------------------
    #!/bin/bash
    # This is a script modified from Picasa wrapper script to launch Navicat.exe

    cd `dirname "$0"`
    navicat_root=`pwd`

    # Wine environment required
    export PATH="$navicat_root/wine/bin":"$navicat_root":$PATH
    export LD_LIBRARY_PATH="$navicat_root/wine/lib":"$navicat_root/lib":$LD_LIBRARY_PATH
    export WINEDLLPATH="$navicat_root/wine/lib/wine"
    export WINELOADER="$navicat_root/wine/bin/wine"
    export WINESERVER="$navicat_root/wine/bin/wineserver"
    export WINEPREFIX=$HOME/.navicat
    export WINEDLLOVERRIDES="msxml3=n" # use native msxml3
    # find the x window server location at [current machine]:[displaynumber=0]:[screennumber=0] to run x window application
    # used in crontab schedule part of navicat
    export DISPLAY=":0.0"

    # create directories
    [ -d "$WINEPREFIX" ] || mkdir -p "$WINEPREFIX"
    [ -d "$WINEPREFIX/drive_c" ] || mkdir -p "$WINEPREFIX/drive_c"
    [ -d "$WINEPREFIX/drive_c/Program Files" ] || mkdir -p "$WINEPREFIX/drive_c/Program Files"
    [ -d "$WINEPREFIX/drive_c/windows" ] || mkdir -p "$WINEPREFIX/drive_c/windows"
    [ -d "$WINEPREFIX/drive_c/windows/temp" ] || mkdir -p "$WINEPREFIX/drive_c/windows/temp"
    [ -d "$WINEPREFIX/drive_c/windows/inf.done" ] || mkdir -p "$WINEPREFIX/drive_c/windows/inf.done"
    [ -d "$WINEPREFIX/dosdevices" ] || mkdir -p "$WINEPREFIX/dosdevices"

    # check integrity of system directories
    for system_dir in \
    drive_c/windows/fonts \
    drive_c/windows/inf \
    drive_c/windows/system \
    drive_c/windows/system32 \
    ; do
    if [ -h "$WINEPREFIX/$system_dir" ] ; then
    if [ `stat --dereference --format %i "$WINEPREFIX/$system_dir"` = `stat --dereference --format %i "$navicat_root/wine/$system_dir"` ] ; then
    continue;
    fi
    [ -d "$WINEPREFIX/$system_dir" ] || rm -f "$WINEPREFIX/$system_dir"
    fi

    [ -d "$WINEPREFIX/$system_dir" ] || ln -s "$navicat_root/wine/$system_dir" "$WINEPREFIX/$system_dir"

    done

    # create Navicat directories
    [ -h "$WINEPREFIX/Navicat" ] && rm -f "$WINEPREFIX/Navicat"
    [ -d "$WINEPREFIX/Navicat" ] || mkdir -p "$WINEPREFIX/Navicat"
    (cd "$navicat_root/Navicat";
    for x in * ; do
    oldlink="`pwd`/$x"
    newlink="$WINEPREFIX/Navicat/$x"
    if [ -h "$newlink" ] ; then
    if [ `stat --dereference --format %i "$oldlink"` = `stat --dereference --format %i "$newlink"` ] ; then
    continue;
    fi
    [ -d "$newlink" ] || rm -f "$newlink"
    fi

    [ -d "$newlink" ] || ln -s "$oldlink" "$newlink"

    done
    )

    # create wine emulated devices
    if [ -h "$WINEPREFIX/dosdevices/c:" ] ; then
    [ -d "$WINEPREFIX/dosdevices/c:" ] || rm -f "$WINEPREFIX/dosdevices/c:"
    fi
    [ -d "$WINEPREFIX/dosdevices/c:" ] || ln -s "$WINEPREFIX/drive_c/" "$WINEPREFIX/dosdevices/c:"

    if [ -h "$WINEPREFIX/dosdevices/z:" ] ; then
    [ -d "$WINEPREFIX/dosdevices/z:" ] || rm -f "$WINEPREFIX/dosdevices/z:"
    fi
    [ -d "$WINEPREFIX/dosdevices/z:" ] || ln -s / "$WINEPREFIX/dosdevices/z:"

    if [ -h "$WINEPREFIX/dosdevices/y:" ] ; then
    [ -d "$WINEPREFIX/dosdevices/y:" ] || rm -f "$WINEPREFIX/dosdevices/y:"
    fi
    if [ -d "$HOME" ] ; then
    [ -d "$WINEPREFIX/dosdevices/y:" ] || ln -s "$HOME" "$WINEPREFIX/dosdevices/y:"
    fi

    # hide error/stdout message
    if test "z$WINEDEBUG" = z ; then
    exec >/tmp/navicat.output 2>&1
    fi

    # install inf
    for infcmd in wine.inf/DefaultInstall ; do
    inffile=`echo $infcmd | cut -d '/' -f 1`
    inftype=`echo $infcmd | cut -d '/' -f 2`

    runreg=0
    if [ -f "$WINEPREFIX/drive_c/windows/inf.done/$inffile" ] ; then
    diff -q "$WINEPREFIX/drive_c/windows/inf/$inffile" "$WINEPREFIX/drive_c/windows/inf.done/$inffile" >/dev/null 2>&1
    if [ $? -ne 0 ] ; then
    runreg=1
    fi
    else
    runreg=1
    fi

    if [ $runreg -gt 0 ] ; then
    "${WINELOADER:-wine}" rundll32.exe setupapi.dll,InstallHinfSection $inftype 128 $inffile
    cp "$WINEPREFIX/drive_c/windows/inf/$inffile" "$WINEPREFIX/drive_c/windows/inf.done/$inffile"
    fi
    done

    # run Navicat.exe
    exec "${WINELOADER:-wine}" "$navicat_root/Navicat/Navicat.exe" "$1" "$2" "$3" "$4" "$5" "$6" "$7"
    --------------------


    Any ideas on getting it to run as a cron would be appreciated!


    --
    Ski_K2
    ------------------------------------------------------------------------
    Ski_K2's Profile: http://forums.opensuse.org/member.php?userid=6818
    View this thread: http://forums.opensuse.org/showthread.php?t=404918


  9. #9
    ken yap NNTP User

    Default Re: cron job not running


    Is this your personal crontab, edited with crontab -e, or the system
    crontab, /etc/crontab? In the second case you need to specify the user
    in the 6th field, like this:

    25 17 * * * pathp /home/pathp/...


    --
    ken_yap
    ------------------------------------------------------------------------
    ken_yap's Profile: http://forums.opensuse.org/member.php?userid=221
    View this thread: http://forums.opensuse.org/showthread.php?t=404918


  10. #10
    Ski K2 NNTP User

    Default Re: cron job not running


    Personal.

    I'm the only user on the system.

    I open a terminal from gnome as personal user, not root

    crontab -e


    --
    Ski_K2
    ------------------------------------------------------------------------
    Ski_K2's Profile: http://forums.opensuse.org/member.php?userid=6818
    View this thread: http://forums.opensuse.org/showthread.php?t=404918


Page 1 of 5 123 ... LastLast

Posting Permissions

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