Can someone help with a cron job ??

I have the temp monitor file going fine per this thread

What I would like to do is take the temperature file created in var/log (var/log/tempcheck.log) and append it to tempcheck.log.yesterday and then have a new one made to dump
the temp information into it.

Similar to the piaware log


What about doing:

$ sudo pico /etc/logrotate.d/temp-check

In that file paste in:

/var/log/tempcheck.log {
  rotate 4

Change the “4” to the number of days you want to keep the logs. It will only hold 4 days (+ the current days log being created).

I think that will do. I’m sure someone will speak up otherwise.

set it for a 2 day rotate … Ill see what it does :slight_smile:


Hmm Getting an error and I think its permissions

-bash: /var/log/tempcheck.log: Permission denied

Not sure which CHMOD setting to use.

Give a fish answer: chmod a+x
Teach fishing answer: man chmod

A log file shouldn’t need executable permissions. I would instead check what the owning UID/GID are, and what the overall permissions are.

The file its self is in /Var/Log … I was trying to just append it each day …

Owner is Root

-rw-rw-r-x 1 root root 3550 Jul 5 22:17 tempcheck.log

Where the error is, its when I log in its supposed to give me the temp of the rig (which it is) but just before that it gives me this error

-bash: /var/log/tempcheck.log: Permission denied

Its all per the above link.

what is the user that is running the temperature logging program.

can you sudo tempcheck > logfile maybe?

I log in as pi …

-rwxr-xr-x 1 root staff 166 Jul 1 08:10 tempcheck

when I do sudo tempcheck > Testfile

It gives

sudo tempcheck > testfile

-bash: testfile: Permission denied

Apparently pi doesn’t have -bash permissions.

On the good side. The job is working found these in my /var/log directory today


see if it fills up tempcheck.log