Answer the question
In order to leave comments, you need to log in
How to remove the system notification "Completed" after working out the script?
Here is the script:
#!/usr/bin/perl
my $timer1 = 11;
my $timer2 = 2;
my $parent = $$;
my $child = fork();
print "parent: ".$parent;
print "\nchild: ".$child;
if ( $$ == $parent ) {
sleep($timer1);
my $killchild = kill("TERM", $child);
print "\nParent kill child\n";
}else{
sleep($timer2);
my $killparent = kill("TERM", $parent);
print "\nChild kill power\n";
}
[[email protected] user]# ./test.pl
parent: 3580
parent: 3580
child: 3581
Parent kill child
[[email protected] user]# ./test.pl
parent: 3587
parent: 3587
child: 0
Child kill power
Completed
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question