Applogies as this is not a HAH specific question but I have spent far too long trying to get the answer to this and had no luck from other Linux forums.
All I want to do is use the cron scedhuler to write to a file located on the HAH (to reset my daily cumulative energy totals)
the command I want to use is
echo '0'>/etc/plugboard/BoilerRunTime
I have therefor added this to the Cron file as 1 0 * * * echo '0'>/etc/plugboard/BoilerRunTime
which doesnt work.
Member for
16 years 10 monthsHow can you get this wrong?
I setup a crontab with the following and it worked perfectly.... I have no idea what you are doing wrong? At 9:11am it put a 0 into the file zero as you'd expect.
NOTE: If you have this file open in another process it might be locked for writes from other processes ie cron. Is your plugboard applet holding the file open?
If you don't want a LF to appear after the zero you can use the switch -n I'm not sure how you are reading this file and whether this would cause you a problem but I thought I'd mentioned it anyway.
Brett
Member for
15 years 7 monthsOK sorted. Notepad appears to be the issue
Thanks for this Brett, I was sure my crontab was good just needed it confirming.
After more headscratching I found the issue. It appears to be due to the way I edit the root file as I hate VI.
I mod it using notepad and the transfer across and use the crontab root command to update the cron scheduler.
Then when I do the following I see:
# cat /etc/crontabs/root
0 15 * * * aliasmsg "rf 1 on"
10 0 * * * aliasmsg "rf 1 off"
0 23 * * * aliasmsg "thermostat 18.5"
0 16 * * * aliasmsg "thermostat 20"
* 6 * * * aliasmsg "boost 1"
1 0 * * * aliasmsg "powerreset o"
2 0 * * * echo 0 >/etc/plugboard/BoilerRunTime
but when I then did a crontab -e, I see this:
0 15 * * * aliasmsg "rf 1 on"^M
10 0 * * * aliasmsg "rf 1 off"^M
0 23 * * * aliasmsg "thermostat 18.5"^M
0 16 * * * aliasmsg "thermostat 20"^M
* 6 * * * aliasmsg "boost 1"^M
1 0 * * * aliasmsg "powerreset o"^M
2 0 * * * echo 0 >/etc/plugboard/BoilerRunTime^M
Therefore ^M has been added by notepad. I then deleted these via VI and all is good.
Will just have to learn VI then I suppose.
Thanks again,
Garry
Member for
16 years 10 monthsDOS files
Then you can use the program "dos2unix" which is shipped on your HAH system if you transfer a file from Windows.
# dos2unix /etc/crontabs/root
TADA - I think of everything before you even know you need it!
Brett
Member for
15 years 7 monthsyou really are too good to us!
Giving us tools we don't even know we need.
I might try to use that with the wife's christmas present.......Honest dear, you really do need those Jeenodes, you just dont know you need them yet :)
Cheers
Garry