Write a program that upon receiving SIGTERM prints the messa
Write a program that, upon receiving SIGTERM, prints the message \"Thank you, I will now terminate\" and then quits.
Solution
#include<iostream>
#include<csignal>
using namespace std;
void signalHandler(int signum )
{
cout<<\" \ Thank you ...I\'ll now terminate \"; exit(signum);
}
int main ()
{
signal(SIGTERM, signalHandler);
while(1)
{
sleep(1);
}
return0;
}
