Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: cron log file location

  1. #1
    cmbotelho NNTP User

    Arrow cron log file location

    Hi,
    i have inserted on my cron the lines below to make some backups but isn't working. I cant find where is the cron log file to see what is going wrong. Anybody can help?

    My crontab:

    @reboot sleep 10; mount -a -t cifs; //Works to mount my samba shares

    00 23 * * * /usr/local/groovy-1.5.6/bin/groovy /mnt/ecmsrv/u/redes/scripts/groovy/backupGeral.groovy;

    30 23 * * * /usr/local/groovy-1.5.6/bin/groovy /mnt/ecmsrv/u/redes/scripts/groovy/backupSisCDI.groovy;


    this commands works fine on shell.

    Ty all.

    Cristiano Botelho

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

    Default Re: cron log file location

    You write "your crontab", but surely a mount command requires root privilege?

  3. #3
    cmbotelho NNTP User

    Default Re: cron log file location

    All my servers i use this line and works fine.

    @reboot sleep 10; mount -a -t cifs; //Works to mount my samba shares

    FYI my version is 10.3

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

    Default Re: cron log file location

    I assume you put that in root's crontab. I think such a command is inherently unreliable because you cannot guarantee that the network is up 10 seconds after the cron daemon is started. The startup of the cron daemon may be totally unrelated to the startup of the network.

    Instead you should let the service smbfs do it, that's what this init script is designed for, instead of cobbling your own. This script is sequenced after network. You should be able to turn on this service from YaST. And you need a cifs entry in fstab of course.

  5. #5
    cmbotelho NNTP User

    Default Re: cron log file location

    Cool. I edited my crontab as root. Will check for this service on Yast and yes i For now this command works to me. My problem is on red lines of cron. Do u know where is the log file?

    Thanks for prompt replies!

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

    Default Re: cron log file location

    Normally the common syslog destination: /var/log/messages. But it doesn't contain any output from the command, only when a job was started. Output from cron jobs normally gets emailed to root.

    You could do this to capture the output:

    Code:
    00 23 * * * /usr/local/groovy-1.5.6/bin/groovy /mnt/ecmsrv/u/redes/scripts/groovy/backupGeral.groovy > /tmp/debug.out 2>&1
    As for the groovy lines, a cron environment is missing some things compared with a login environment. The PATH is much reduced and if your script makes assumptions about the PATH, some commands will not be found.

  7. #7
    cmbotelho NNTP User

    Default Re: cron log file location

    I checked the /var/log/messages and could see that the commands are been executed normaly. The problem is on JAVA_HOME PATH when the command run. will create an script that sets the path for java and after run the groovy commands. thanks for your help. Later i post here the results!

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

    Default Re: cron log file location

    You can do it inline in the crontab:

    00 23 * * * JAVA_HOME=/somedir/somewhere /usr/local/groovy-1.5.6/bin/groovy /mnt/ecmsrv/u/redes/scripts/groovy/backupGeral.groovy

    It's not special to crontabs, it's part of the shell. You can set environment variables for the duration of a command in the shell using that notation, for example:

    $ JAVA_HOME=/alternatedir/somewhere some-java-program

    works to change JAVA_HOME temporarily for that command.

  9. #9
    cmbotelho NNTP User

    Default Re: cron log file location

    Hi again.
    It works fine now.Ty for your tips!

  10. #10
    Join Date
    Jun 2008
    Location
    Belgrade, Serbia
    Posts
    732

    Default Re: cron log file location

    I cant find my cron task in /var/log/messages and I know it was executed as I verified process list and it was running.

    How do I see log when this task started?

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

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