Cron jobs logs after they run

Status
Not open for further replies.

craniu3000bis

Dabbler
Joined
Jun 5, 2017
Messages
13
Hello,

I'm using FreeNAS-11.0-U1 (aa82cc58d)
Do you know where cron jobs store the logs?
I have added a Cron Job from UI and I want to see if a cron job has run or not.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Please try to do an internet search to find answers to questions like this in the future, it will save you time and the wait while someone writes an answer.

A Google search for "freebsd cron log" comes up with this link. We use FreeBSD in the search because FreeNAS is based on FreeBSD.

So now if you log into your FreeNAS and jump into the shell you can zip over to the file /etc/syslog.conf and locate where the cron log is. For my system the cron log is located at /var/log/cron.

Cheers!
 

craniu3000bis

Dabbler
Joined
Jun 5, 2017
Messages
13
Thank you, for your information.
I did a search on google but I use FreeNAS instead of FreeBSD and this was the cause of not finding anything,
In this location /var/log/cron I could see only the cron jobs ran by the system and nothing related to my cron jobs.
Although I have run a cron job manually I didn't see anything in the log
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Yes, many people either don't put together that FreeNAS is based on FreeBSD or forget it. I try internet serached both ways and I tend to find some help that way.

How do you run a CRON job manually? That is just running the job, not a CRON initiated job so I wouldn't expect it to be in the cron log.

I'm going on vacation soon but please provide the following...

1) The listing of your cron file from /etc/cron
2) The listing from the /var/log/cron

If I'm already on vacation then hopefully someone else will chime in.

Good Luck!
 

craniu3000bis

Dabbler
Joined
Jun 5, 2017
Messages
13
First I have create a cron job from Web interface and run it manually, to see if it is working.
All good.

Then I've check the cron log to see if it recorded. Here i got stuck cause i didn't find the log of the cron job.
Now makes sense, cause I have run it as job.

It did't create such file under /etc/cron I have only cron.d which is empty
Under /var/log/cron i can see the cron jobs that where ran

I got my answers, thank you very much and Happy vacation :)
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504

craniu3000bis

Dabbler
Joined
Jun 5, 2017
Messages
13
Oh...
I have attach the content of 2 files.
 

Attachments

  • cron log.txt
    139.4 KB · Views: 466
  • crontab.txt
    3.3 KB · Views: 534

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
I think @joeschmuck was referring to /etc/crontab, for future reference.
I could have sworn that I typed crontab.

Anyway, getting back to the cron log file... You either need to change your cron task to run lets say once every 10 minutes and then wait for the task to be run from the CRON. Once it's run you should see it listed in the log file. Manually running it is not the same as CRON running it as far as I know. Once you know that it executes fine then change the cron job back to the schedule you desire and then you can check the log if needed to ensure it ran. Realize that you selected @weekly which will run the task on Sunday at 0:00. So you can just wait until sunday morning to give it a look.
 

craniu3000bis

Dabbler
Joined
Jun 5, 2017
Messages
13
Yup, I did a test now with a cron job schedule for every 5 min and now I can see it in the log file.
Thank you very much.
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Glad it's working for you.
 
Status
Not open for further replies.
Top