if (getppid==1 or !kill (0, getppid)) { # Parent is dead, long live the child! } else { # Parent still alive. }