to get a remote os.stat, just create a connection to the remote machine and
use the remote machine's os.stat:
c = rpyc.classic.connect("myserver")
while True:
statres = c.modules.os.stat("/some/file/on/myserver.txt")
if statres.st_mtime < time.time() - 15*60:
send_email()
time.sleep(5*60)
-----------------------------------------------------------------
*Tomer Filiba*
tomerfiliba.com <http://www.facebook.com/tomerfiliba>
<http://il.linkedin.com/in/tomerfiliba>
On Tue, Feb 21, 2012 at 15:32, mick <[email protected]> wrote:
> Just discovered RPyC and I am sure it can do what I want, just cannot
> figure out how.
>
> I have two servers (Ubuntu 11.04) and a control program that can run
> on either one, which also continuously updates a heartbeat file while
> it is running. I have a monitor program which checks the date of the
> heartbeat file, if it is more that 15 minutes old it sends me an
> email.
>
> This works fine on one server, but I want to be able to monitor the
> heartbeat on the other server, so the monitor will be happy if either
> the local or the remote heartbeat is less than 15 minutes old.
> Currently if the one server dies I cannot detect it.
>
> Could someone give me a pointer on how to do this? I have read
> through the documentation and cannot find the equivalent of os.stat
> for a remote file.
>
> Thanks
> Mick
>