mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-12-23 22:46:44 +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) {
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user