[PD] process id again for building a watchdog

brandt at subnet.at brandt at subnet.at
Tue Oct 26 00:01:20 CEST 2010


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




More information about the Pd-list mailing list