bcache: wirtualny przełącznik do zmiany trybu pracy bcache
Zastosowanie: włączenie szybszego, ale mniej bezpiecznego trybu
w czasie oglądania czegoś w Kodi.
Wymaga unitu systemd toggle-bcache@.service:
---
[Unit]
Description=toggle bcache mode for all devices
[Service]
Type=oneshot
WorkingDirectory=/sys
ExecStart=/usr/bin/fd --full-path bcache/cache_mode --exec sh -c "echo %i > {}; "
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
ProtectControlGroups=yes
---
Oraz regułki polkit openhab.rules:
---
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.systemd1.manage-units") {
var unit = action.lookup("unit");
if (unit == "toggle-bcache@writethrough.service" ||
unit == "toggle-bcache@writeback.service") {
var verb = action.lookup("verb");
if (verb == "start" && subject.user == "openhabik") {
return polkit.Result.YES;
}
}
}
});
---
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
|
||||||
/* czy jesteśmy dłużej poza domem? */
|
/* czy jesteśmy dłużej poza domem? */
|
||||||
Switch sHolidayVacancy "Jesteśmy poza domem"
|
Switch sHolidayVacancy "Jesteśmy poza domem"
|
||||||
|
|
||||||
|
Switch sBCacheWriteback "Bcache w trybie writeback" { exec=">[ON:systemctl start toggle-bcache@writeback] >[OFF:systemctl start toggle-bcache@writethrough]" }
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ then
|
|||||||
|
|
||||||
Mpd_quodlibet_StartStop_expected.postUpdate(Mpd_quodlibet_StartStop.state)
|
Mpd_quodlibet_StartStop_expected.postUpdate(Mpd_quodlibet_StartStop.state)
|
||||||
Mpd_quodlibet_StartStop.sendCommand(OFF)
|
Mpd_quodlibet_StartStop.sendCommand(OFF)
|
||||||
|
|
||||||
|
sBCacheWriteback.sendCommand(ON)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -41,5 +43,6 @@ then
|
|||||||
sendCommand(sOWFS01, ON)
|
sendCommand(sOWFS01, ON)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sBCacheWriteback.sendCommand(OFF)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ sitemap pbrk label="Szczegóły techniczne"
|
|||||||
Frame {
|
Frame {
|
||||||
Text item=dtSunset_Time
|
Text item=dtSunset_Time
|
||||||
Text item=wClouds
|
Text item=wClouds
|
||||||
|
Switch item=sHolidayVacancy
|
||||||
|
Switch item=sBCacheWriteback
|
||||||
}
|
}
|
||||||
|
|
||||||
Group label="Łączność" {
|
Group label="Łączność" {
|
||||||
|
|||||||
Reference in New Issue
Block a user