Login  Register

Re: Get OS uptime

Posted by NorbertHartl on Mar 19, 2015; 12:59pm
URL: https://forum.world.st/Get-OS-uptime-tp4813047p4813178.html


Am 19.03.2015 um 13:26 schrieb Esteban Lorenzano <[hidden email]>:


On 19 Mar 2015, at 13:08, Norbert Hartl <[hidden email]> wrote:


Am 19.03.2015 um 11:51 schrieb Esteban Lorenzano <[hidden email]>:


On 19 Mar 2015, at 11:35, Julien Delplanque <[hidden email]> wrote:


On 19/03/15 11:10, Esteban Lorenzano wrote:
'/proc/uptime' asFileReference readStreamDo: [ :stream | stream contents ].

is better way.

but you will still get an empty string because actually ‘/proc’ does not contains real files… so the file plugin does not applies there (and is another debate if it should…)

you should use OSProcess instead (installable from Configurations Browser)

(PipeableOSProcess command: 'uptime') upToEndOfFile.

Esteban
Oh, I didn't know '/proc' doesn't contains real files. I tought there
were files in this directory since you do 'cat /proc/uptime' in a shell.

that’s the O.S. cheating you :)

Can you elaborate on that statement. What is a "real" file and why are the files in /proc not real?


"proc is very special in that it is also a virtual filesystem. It's sometimes referred to as a process information pseudo-file system. It doesn't contain 'real' files but runtime system information (e.g. system memory, devices mounted, hardware configuration, etc). For this reason it can be regarded as a control and information centre for the kernel. In fact, quite a lot of system utilities are simply calls to files in this directory.”

last part of that sentence is what made me think that *maybe* FilePlugin should thread them as regular files… :)

That's my point. Or better I like to know how the plugin can distinguish them. Usually there shouldn't be a difference. I know the /proc filesystem. It is what unix is all about. Make every information available as file. You say it is a virtual filesystem? Yes, but there are only virtual filesystems in linux. Below is always a device driver accessing disks, cdroms, etc. Memory or the kernel does not make a difference. They are all the same and they should according to unix. So I still not understand the problem.

Norbert