WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: picore in raspberry zero problem with cron  (Read 2731 times)

Offline jfrancois.michiels

  • Newbie
  • *
  • Posts: 4
picore in raspberry zero problem with cron
« on: December 20, 2020, 06:42:55 PM »
Hi,

I'm configuring a raspberry with a temperature sensor.
It save measurements within a csv file.
I want to be able to switch on and off the device anywhere (even without wifi, keyboard, monitor, ...)
Therefore, I would like to use cron to automate the backup of the measurements.

I have used the approach described in
https://computerramblings.wordpress.com/2013/03/18/tiny-core-linux-part-2-cron-and-back-up/
After doing this and retry a ssh connection, I have a warning "remote host identification has changed".
I'm unable to redo a ssh connection.

I need to connect a monitor and a keyboard, and reset a new password and then I can redo a ssh connection.
It seems crontab changed the password.
Can somebody explain what happens and have a solution?

Thank you so much.

Offline vinceASPECT

  • Hero Member
  • *****
  • Posts: 809
Re: picore in raspberry zero problem with cron
« Reply #1 on: December 20, 2020, 06:45:20 PM »
hello forum,

a chronological job.........which may indeed experience issues within a hardware unit that does not have  a time support.

............O__o.........

vin

Offline jfrancois.michiels

  • Newbie
  • *
  • Posts: 4
Re: picore in raspberry zero problem with cron
« Reply #2 on: December 20, 2020, 06:58:56 PM »
Hi VInce,

yes, I know.
To explain the background,
I'm want to measure the temperature in the greenhouse, in the cold room, during witloof forcing, ...
I'm currently using min-max thermometer with alcohol. This is cheap and very unreliable.

If I have a 2 min delay between the time recorded and the temperature,
If I'm loosing 15 min of data because I program the back up every 15 min,
..... I know it and this is perfectly fine for my purpose.

Then my very question is
how the job can create the "remote host identification has changed" warning?

Hope somebody will have an answer.
Re-thank

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1267
Re: picore in raspberry zero problem with cron
« Reply #3 on: December 20, 2020, 09:03:08 PM »
Have you done backups?   If you don’t backup, ssh keys will get regenerated at reboot.


Also, who is the crontab owner?   root or tc?

Offline jfrancois.michiels

  • Newbie
  • *
  • Posts: 4
Re: picore in raspberry zero problem with cron
« Reply #4 on: December 22, 2020, 12:09:20 PM »
Hi Paul,

I'm doing backup and everything is going well when I'm using "filetool.sh".

Your second point is very likely The job owner is tc and fails to save ssh keys, passwords, etc.
Now, I don't know how to change the job owner.

Regards.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11695
Re: picore in raspberry zero problem with cron
« Reply #5 on: December 22, 2020, 02:12:43 PM »

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: picore in raspberry zero problem with cron
« Reply #6 on: December 22, 2020, 02:59:22 PM »
You could just write to a persistent location on /mnt/mmcblk0p1 (unmounted by default) or /mnt/mmcblk0p2. More writes on SD card though.

ssh works well once the keys are generated and saved.

cron has a few things that tricked me, the user and the timezone.

Offline jfrancois.michiels

  • Newbie
  • *
  • Posts: 4
Re: picore in raspberry zero problem with cron
« Reply #7 on: January 06, 2021, 04:15:26 PM »
Time for me to explain what I did.
I solved the bug by adding in the cron a timezone task
My crontab file looks like
*/5 * * * * TZ=CET-1CEST,M3.5.0,M10.5.0/3 date > /home/tc/date.log
*/5 * * * * filetool.sh -b > /home/tc/cron.log

-----------------------
Nevertheless, while continuing the project, I created a python file to record temperature.
When manually started, the python script is saving the records with the correct time (Brussel timezone).
I have added the python script in the bootlocal.sh file to start it automatically at boot.
When the python script is started at boot, it save the time in the London timezone. For now, I will just correct for one hour.

Thank you all for your help.