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
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.
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?
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.
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.
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!
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:
Only the start time of the job (by the computer clock of course) and the command are logged. It doesn’t log how long the command took, or when it finished.
If you need to know these things, you can put your own commands in the cron job before and after the work. E.g.