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
Hi
Sorry for falling into the old "Linux is good / Windows is bad" argument, but my experiences with computers in exhibitions running Windows 7 were almost always bad. Not that it wouldn't run stable, but I found it very hard to create a setup suitable for an exhibition situation which has completely different needs than the standard corporation "everything is controlled by the domain" office situation which Windows 7 basically is made for. Especially when it comes pre-installed one hardly has the chance to take all hurdles beforehand to ensure flawless *non-interactive* exhibition service. Things are getting really difficult, if suddenly some warnings pop up while the machine is hidden behind the wall and keyboard / mouse access are hard to achieve. Things even get worse, if after running some days without troubles suddenly some update is due although the box is not connected to the net and there is no other way to make the regular pop-ups disappear than either find some Internet in the exhibition space or go the hard way and take the machine out from behind the wall and bring it to some place with Internet.
OK, you might find it a bad idea anyway to put the box behind the wall but you get my point. In my experience Macs/OS X are very easy to handle and are quickly set up for exhibition. Things like autostart in the morning and auto-shutdown in the evening are configured within seconds. And what turned out most important: Once you have it up and running and tested in the lab, you can be quite sure that it'll reliably run the same way for the next weeks in the wild. Compared to Windows 7 a naked OS X is pleasingly non-interactive. The same goes for Linux, plus it comes with a high degree of flexibility. Personally, I prefer the latter for exhibitions, but that is also my political bias.
I am in doubt if writing the watchdog in C is the best approach in your situation. Personally, I found Pd(-vanilla) to run very stable. Things are getting trickier if some externals are involved. Why not writing the watchdog in Pd and if you don't trust Pd that much, run two instances of it that watch each other?
Roman
On Tue, 2010-10-26 at 00:01 +0200, brandt@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
On Tue, 26 Oct 2010, brandt@subnet.at wrote:
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.
[gf/getpid] would give you the pid of the server process, but on windows it will refuse to work because it's also supposed to give you the ppid at once, and getppid() does not exist in MinGW.
When pd starts the client process, it does two things that lose the pid : first it doesn't store the value anywhere at all, but also, it starts a shell that starts the client, so, it only ever knows the pid of the shell, and never the pid of the client.
If you want to know the pid of the client, you have to register a receive-symbol, let's say "pidstuff", and then you have to send a tcl message :
sys_gui("pd pidstuff [pid] ;\n");
But IIRC, proc pd doesn't work anymore in Pd 0.43, unless it's been changed recently in Pd 0.43 ... at the very least, there is code in the GridFlow library that adds back support for proc pd _if_ you are running Pd 0.43, so that existing code in GridFlow can continue to work. I don't know how GUI externals are supposed to continue to work under those circumstances... I haven't looked.
If it works, you will then receive a message on the receive-symbol you registered. You need to have registered a float-method (or equivalent list-method or anything-method) for the class of the object that is bound to the receive-symbol.
I don't know anything about pd's watchdog process pid.
| Mathieu Bouchard ------------------------------ Villeray, Montréal, QC
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, brandt@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