trynd / wren

Linux boot platform that provides a portable, multi-system, run-in-memory Linux environment.
GNU General Public License v3.0
0 stars 1 forks source link

wren (control script): Add "usage" option #24

Closed codewithmichael closed 9 years ago

codewithmichael commented 9 years ago

Based on branch release-0.2.0

This patch add a "usage" option to the wren control script. The usage option displays total, used, and free statistics for memory (combined ram+swap), active storage, and boot device (if mounted). It displays in bytes by default, but has a -h/--human option for human readable values.

Example:

user@computer:~/Desktop$ sudo wren usage -h
           total    used    free  unallocated
memory:     4.9G    2.2G    2.6G         1.9G
active:     1.0G  118.9M  776.8M             
device:     5.9G    2.8G    2.7G
codewithmichael commented 9 years ago

I'm going to add a bit more to this. I'm going to check the BOOT_SAVE_TO_RAM boot flag. If it's disabled then we're running directly on an image and that should show "save" usage instead of "active" usage.

While I'm at it, I'll disable the "save" and "+active" functions as well (they just crash out right now). This will be particularly useful on +active --check, since it's reporting as if the save space was active space which can trigger the cron to attempt a "+active" if the on-device safe file gets too full (which will then just crash on repeat).

codewithmichael commented 9 years ago

I decided against disabling the wren save function when running directly from a save file, as it can be used to back up the current save elsewhere.

This commit adds a new store section/subcommand to the status function which reports "active" or "save", depending on whether you're using active storage or running directly from a save file.

The usage command has been updated with an additional save subcommand/section that only appears when running from a save file (and active disappears) or when requested directly — but it's empty (blank dashes) when using active storage.

The +active command has been completely disabled when running from a save file, so the increase-active-capacity cron entry correctly exits on each run.