admin管理员组

文章数量:1304540

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?

Share Improve this question asked Feb 4 at 10:09 Gee ShuklinGee Shuklin 7,93711 gold badges50 silver badges92 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

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)

本文标签: linuxSaving a copy of proc and sys for testsStack Overflow