I'm writing a system diagnostic utility and I want data from different servers to be saved as testcases for it.
I want to "archive" a copy of /proc
and /sys
and unpack it as a testcase for my utility. (one testcase for one inspected server).
I understand that procfs and sysfs are very special, so, may be there are libraries/utilitites which are designed for that and can do it properly? Handling all symlinks, skipping inaccessible files, ignoring memory maps, loops, etc?
I'm writing a system diagnostic utility and I want data from different servers to be saved as testcases for it.
I want to "archive" a copy of /proc
and /sys
and unpack it as a testcase for my utility. (one testcase for one inspected server).
I understand that procfs and sysfs are very special, so, may be there are libraries/utilitites which are designed for that and can do it properly? Handling all symlinks, skipping inaccessible files, ignoring memory maps, loops, etc?
You can start experimenting with utility rsync
:
rsync -aHAX --numeric-ids --exclude="*/maps" --exclude="*/mem"\
--exclude="*/kmem" --exclude="*/port" --exclude="*/fdinfo"\
--exclude="*/sysrq-trigger" --exclude="*/kcore"\
--exclude="*/core_pattern" --exclude="*/perf_event_paranoid"\
/proc /sys /tmp/proc-sys-$(date +%FT%T)