Capturing SIGTERM and SIGKILL events in control script.
- bhavna
- Posts:37
- Joined: Mon Dec 20, 2010 1:12 pm
Capturing SIGTERM and SIGKILL events in control script.
Is there any way to capture SIGTERM or SIGKILL events in control script? This is required, so that the control script can release resources ( in my case close a COM port handle) before the control manager running the script is closed.
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: Capturing SIGTERM and SIGKILL events in control script.
Hello,
there is no possibility to start a specific function when the process receives the signal SIGTERM. If SIGTERM is send the manager stops in a proper way.
SIGKILL will terminate the process immediately.
Best Regards
Leopold Knipp
Senior Support Specialist
there is no possibility to start a specific function when the process receives the signal SIGTERM. If SIGTERM is send the manager stops in a proper way.
SIGKILL will terminate the process immediately.
Best Regards
Leopold Knipp
Senior Support Specialist
- ragrawal
- Posts:22
- Joined: Tue Dec 14, 2010 5:53 am
Re: Capturing SIGTERM and SIGKILL events in control script.
Hello,
Can you suggest any other way to release the resources acquired by a control script in case it terminates / or terminated by closing the control manager from the PVSS console?
Our problem is that we have written a control script which communicates on the serial port and when the control manager is killed, the port handle is not released and any next run or any other application is not able to open the serial port.
Thanks and regards
Rajesh
Can you suggest any other way to release the resources acquired by a control script in case it terminates / or terminated by closing the control manager from the PVSS console?
Our problem is that we have written a control script which communicates on the serial port and when the control manager is killed, the port handle is not released and any next run or any other application is not able to open the serial port.
Thanks and regards
Rajesh
- mkoller
- Posts:741
- Joined: Fri Sep 17, 2010 9:03 am
Re: Capturing SIGTERM and SIGKILL events in control script.
On a Linux/Unix system, the kernel (!) is responsible for freeing resources a process has allocated and it also handles the closing of files (e.g. serial ports) a process has opened.
Probably you started some sub-process from the ctrl script which inherits the open file descriptors ?
Note: SIGKILL (aka kill -9) can not be caught by a process (see" man 7 signal": The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.)
Probably you started some sub-process from the ctrl script which inherits the open file descriptors ?
Note: SIGKILL (aka kill -9) can not be caught by a process (see" man 7 signal": The signals SIGKILL and SIGSTOP cannot be caught, blocked, or ignored.)
- ragrawal
- Posts:22
- Joined: Tue Dec 14, 2010 5:53 am
Re: Capturing SIGTERM and SIGKILL events in control script.
Thanks for the reply ...
I am working on a windows machine. Pl. suggest.
regards,
Rajesh
I am working on a windows machine. Pl. suggest.
regards,
Rajesh
- Gertjan van Schijndel
- Posts:634
- Joined: Mon Aug 02, 2010 10:37 am
Re: Capturing SIGTERM and SIGKILL events in control script.
With a control extension you might be able to get the SIGTERM and release your resources.
But it might be easier to place the control code in a panel and use the terminate event to release your resources. When you use the '-silentMode' option it does not require an ui license.
But it might be easier to place the control code in a panel and use the terminate event to release your resources. When you use the '-silentMode' option it does not require an ui license.