Hi again I just had a thought: When you know the PID of the process, you can only test, if that PID is still running or not, but that's it. If you build your watchdog in Pd, it's quite easy to implement it in a way, that it checks not only running/not running, but also different other states from the 'sheep' patch. You simply need to set up a communication path through [netsend]/[netreceive] or [netserver]/[netclient] from maxlib.
Roman On Tue, 2010-10-26 at 00:01 +0200, bra...@subnet.at wrote: > hi all > > does anybody know how i can get the process id in win7 of every > instance of three pd´s to use them for a watchdog, which is checking, > if the instances are still alive and if not kill the one not > responding and open it again. > > i would like to check for an "ever" running installation, which is > done in pd, if all of the instances are working and not to restart the > computer every 24 hour, which i feel, is not very elegant. > > so, my idea is to have an objekt which is checking at the startup of > the instance its PID, storing it and sends it back to the watchdog on > demand, via netsend. > > the watchdog itself should, as i feel been written in c or anything > else but not pd. > > i would like to code the watchdog, but my knowledge in coding is as > low as low..... :-) since i´m "just" a patcher. even the process of > compiling in windose is something like a country of questions and > miracles, but anyhow, i´ve once was trained in programming c.... but > pd was far too cool to practice that. i´ve made all my dreams come > true within pure data.....thank you by the way. > > maybe the snippet below is a start... > > ________________________________________________________________________________ > > Program to print its Process ID, Parent Process ID and Group ID > > #include <stdio.h> > #include <unistd.h> > #include <stdlib.h> > #include <sys/types.h> > > int main() > { > pid_t pid, ppid; > gid_t gid; > > /* get the process id */ > if ((pid = getpid()) < 0) { > perror(" > unable to get pid"); > } else { > printf(" > The process id is %d", pid); > } > > /* get the parent process id */ > if ((ppid = getppid()) < 0) { > perror(" > unable to get the ppid"); > } else { > printf(" > The parent process id is %d", ppid); > } > > /* get the group process id */ > if ((gid = getgid()) < 0) { > perror(" > unable to get the group id > "); > } else { > printf(" > The group id is %d > ", gid); > } > > return(0); > } > ______________________________________________________________________________ > > any help preciated > sorry for my english > der.brandt > > thank you > > > _______________________________________________ > Pd-list@iem.at mailing list > UNSUBSCRIBE and account-management -> > http://lists.puredata.info/listinfo/pd-list _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list