Question

I am on an effort to sending pseudo-filesystem to other machine.

In this case, I am using /proc/cpuinfo and /proc/meminfo as the pseudo-filesystem example.

I have two computer that can communicate each other in ssh.

Now, I am trying to build an *.sh code to secure copy some system file from other computer. The code was:

#INPUT
export MASTER=user@11.1.111.11
export HELPER=user@12.1.122.12


#Obtaining CPU and Memory Data
scp $MASTER:/proc/cpuinfo /master/.
scp $MASTER:/proc/meminfo /master/.
scp $HELPER:/proc/cpuinfo /helper/.
scp $HELPER:/proc/meminfo /helper/.

The idea is that I can run this script in any computer (either Master or Helper computer).

However, later on the copied files are blank and has no information inside. I try to sudo chmod and sudo chown the /proc/ folder but the system said permission denied. FYI, I do not activate root user and just using sudo all the time.

Can anybody guide me to some solutions please?

Additional info and improvisation: The full code is in jsfiddle. I am just trying to use collaboration option by jsfiddle though this code is not a JavaScript. http://jsfiddle.net/santosasandy/sWYLL/#&togetherjs=hCO3VuPwO4

No correct solution

OTHER TIPS

It appears that scp first uses stat to determine the size of the file being transferred, and then transfers up to that number of bytes. Because /proc is a pseudo-filesystem, and /proc/cpuinfo is a pseduo-file, stat reports its size as zero bytes. Therefore, scp transfers nothing.

In contrast, cp appears to just read blocks from the file until it can read no more, so the zero size reported by stat is irrelevant.

To copy the file to another system it seems you'll have to first use cp to make a local copy, and then use scp to transfer over the network.

You can use cat to read from the pseudo files, instead of trying to copy them. For example:

ssh $MASTER 'cat /proc/cpuinfo' > /master/cpuinfo
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top