summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-core/nv-sync/nv-sync/nv-sync.service
blob: bad3329d31afd04a1b99a19b2f936b7e5d40371b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
[Unit]
Description=Overlay sync to NV storage

[Service]
# Run rsync periodically to sync the overlay to NV storage
ExecStart=bash -c 'while true; do rsync -a --delete /tmp/.overlay/ /tmp/.rwfs/.overlay; sync /tmp/.rwfs/.overlay; sleep 10; done'
# On shutdown, archive the bash history so we don't lose it and run one last sync
ExecStop=bash -c 'history -a; rsync -a --delete /tmp/.overlay/ /tmp/.rwfs/.overlay; sync /tmp/.rwfs/.overlay; sleep 5'
# Due to sync delay stopping this service will take more than default 10 seconds
TimeoutStopSec=20

[Install]
WantedBy=multi-user.target