-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto backup of past long-term graphs #44
Comments
Should prob move this to the docs and then close this ticket |
Toby, the problem is that as they are now, the monthly script (as described above) does not back up February, and skips the last day for months with 31 days. Someone with programming skills (which I don't have) should probably have a look at the scripts before adding this to the documents... |
Hi Toby and Quaxo76, I have written a bash script to archive the graphs for a permanent graphical overview of the past records. The archive folder is placed in /home/pi/.temperature and contains subfolders for the years, weeks and months. The daily graphs will be placed in a folder named by month below the year-folder and the 7- and 30-day-graphs will be placed in folders "weekly" and "monthly" below the year folder. The script should be self-explaining:
Copy the contents into a file named I will try to show the contents if this archive as an image gallery (I hope PiGallery will work) but have not tried yet. Thank you, Toby, for a great project! |
Awesome work, thanks all 😄 |
You're welcome :) There is no "proper" webserver included in temperature-machine, right? Otherwise I would try to use that to display the archive. |
It has a webserver embedded, if you send backup files to the |
This looks like a good moment to mention again a wish... To add to the
graph screen, maybe in the title or somewhere else, the "time frame" (date
and time) of that graph. That would also help in case of a crash... A few
months ago my system crashed and stopped updating the graphs, and I didn't
notice for days... :)
Il giorno Ven 1 Mar 2019, 15:23 Toby <notifications@github.com> ha scritto:
… It has a webserver embedded, if you send backup files to the assets
folder (from memory), they'll be available via a browser (just with no UI
if that makes sense)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#44 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Ah5kiAUa1PfZXptyejsKpKA9hk5b1VYqks5vSTfrgaJpZM4Rjjbe>
.
|
Yep, good call. Did we capture that as a specific issue on Github? If not, can you add one pls? |
Here is a quick workaround, at least for the graphs that are archived with above script: install ImageMagick (
It's not very pretty because font and font size are different from the rest of the text on the graphs. Maybe you can give a hint about the font(s) used, Toby? In any case there are lots of options to change the look or positioning of the text: ImageMagick v6 Examples -- Text to Image Handling. And of course it would be best if temperature-machine put the text on the graphs natively... |
I couldn't get PiGallery to work but Single File PHP Gallery is very easy to setup and works very well. You just have to install a webserver, e.g. |
I've written three short scripts that save the small graphs to three folders (the 1-day at the end of the day, the 1-week at the end of the week, and the 1-month at the end of the month) to keep them for future reference. They are activated using cron. Maybe others could be interested in this, and it could be made an option in the software?
My scripts are really crude, as I'm not at all an expert at this. The 24-hour graph is backed up at 23:59 each day, the 7-day at 23:58 on Sundays, and the monthly at 23:57 on the 30th day of the month. Not the 31st because of course not all months have 31 days, and those months would be skipped. Now that I think of it, with my script February probably gets skipped too, so this should be looked into.
It would have been better to save the files at 0:00 of the first day of the month (and the same for the other graphs) but then it would already be the following month, and since I use the "date" command to time-code the files, then the file name would not match the period of time it refers to.
Anyway, I created three folders under .temperature:
Then I created the three scripts, named daily_copy.sh, weekly_copy.sh, monthly_copy.sh. They just copy the relevant file to the correct folder (date-coding it in the filename).
daily_copy.sh:
weekly_copy.sh:
monthly_copy.sh:
I then made them executable:
Then I edited the file /etc/crontab and added the following lines:
and, without the need to reboot, I stopped and restarted cron:
and that's it. Very crude, but it works, with the exceptions described above...
Cristian
The text was updated successfully, but these errors were encountered: