Enhance pbs_snapshot to be non-root friendly
Motivation:
pbs_snapshot was only supported as being run by root user because it needed to capture protected data (like sched_priv, server_priv, etc.). This means that any automated script, PTL test or other program that wants to use pbs_snapshot was also needed to be run as root. So, making it non-root friendly removes this restriction.
Design Discussion:
http://community.pbspro.org/t/running-pbs-snapshot-with-sudo/786
Interface Changes:
New option to pbs_snapshot "--with-sudo":
When provided, pbs_snapshot will use PTL's sudo infrastructure to run necessary commands and copy protected files via sudo.
When using this option, the user doesn't need to run pbs_snapshot itself with sudo (i.e, no need to do "sudo pbs_snapshot ... "), or run it as root user.
This option is turned off by default.
If your sudo rules reject any of the commands being run with sudo by pbs_snapshot, it will log "ERROR" type log messages for them and move on to capturing whatever data it can.
Example usage: pbs_snapshot -o $HOME --with-sudo