The heating system of my house creates a log file per week, per zone ( currently 3 zones: living room, kitchen and sleeping room). Every week, and on the same day of the week as the first day of the year, it starts a new log file. So to see the nice little graphs plotting temperature - actual and desired - and valve state, once a week, I have to ssh onto the server, manually adapt a little script and run it.
Until today!
I finally beat my laziness, and wrote a php script, took about 5 minutes to write. It is a brute force script just to get the job done. This to prove that a lot of time is wasted in activities that can very easily be automated and are of no interest to be kept manual.
So here is my script.
All, or almost all of my home automation run on php scripts being executed by a crontab.
Now, once a year I'll have to adapt the crontab file...maybe I should think about automating that also..
$comand = "rm kitchen.log livingRoom.log sleepRoom.log";
exec($comand);
$comand = "ln -s kitchen-";
$comand = $comand . date("Y-W");
$comand = $comand . ".log kitchen.log";
exec($comand);
$comand = "ln -s livingRoom-";
$comand = $comand . date("Y-W");
$comand = $comand . ".log livingRoom.log";
exec($comand);
$comand = "ln -s sleepRoom-";
$comand = $comand . date("Y-W");
$comand = $comand . ".log sleepRoom.log";
exec($comand);
and the crontab line
#once per week, for 2009 on thursday, first thing in the day, rotate the logs
15 0 * * thu /usr/bin/php /tmp/automate_log_change.php
LEGO Traffic Light
7 years ago