Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # this is from The Python
- # Standard Library by example
- # ISBN13: 9780321767349
- import signal
- import os
- import time
- def receive_signal(signum, stack):
- print 'Received:', signum
- # Register signal handlers
- signal.signal(signal.SIGUSR1, receive_signal)
- signal.signal(signal.SIGUSR2, receive_signal)
- # Print the process ID so it can be used with 'kill'
- # to send this program signals.
- print 'My PID is:', os.getpid()
- while True:
- print 'Waiting... '
- time.sleep(3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement