mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-22 17:22:58 +01:00
✏️ Check if state is changed before saving it
This commit is contained in:
parent
61ddd73a8c
commit
ee25207856
@ -29,7 +29,15 @@ function getStatus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setStatus(state) {
|
function setStatus(state) {
|
||||||
fs.writeFileSync(statusPath, JSON.stringify(state));
|
if (fs.existsSync(statusPath)) {
|
||||||
|
let old_state_str = fs.readFileSync(statusPath).toString();
|
||||||
|
if(old_state_str !== JSON.stringify(state)){
|
||||||
|
fs.writeFileSync(statusPath, JSON.stringify(state));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
fs.writeFileSync(statusPath, JSON.stringify(state));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.init = init;
|
exports.init = init;
|
||||||
|
Loading…
Reference in New Issue
Block a user