OpenWrt Forum Archive

Topic: nvram commit (one at a time)

The content of this topic has been archived on 7 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hey guys,
I am wondering if there is any way to make sure that theres only one nvram commit happening at any given moment?
Thanks,
..R

there isn't in the nvram binary itself, but you can do the same using a lockfile or something of the like..

this is psuedo-code, so adapt it wink

if ( !file_exists(/tmp/nvramcommit.lock) ) {
    touch /tmp/nvramcommit.lock && nvram commit && rm /tmp/nvramcommit.lock
}
I had this in a code block, but this new punbb board can't see the end block for some reason?

you could put this in your script, or if it isn't a script, just make a wrapper, say nvcommit.sh or something wink

(Last edited by trevorj on 18 Apr 2005, 01:20)

rohan208 wrote:

Hey guys,
I am wondering if there is any way to make sure that theres only one nvram commit happening at any given moment?
Thanks,
..R

Why? What are you doing that commits so often?

A commit will write all of the current nvram settings to flash; you don't need to commit after each setting. Constantly writing to the flash will eventually lead to failure.

The discussion might have continued from here.