Stopping Services
Hi,
I'm wanting to get a 'stop' (or similar) signal when the system is shutting down, so I can close my program down nicely. I've setup a script and added it using 'chkconfig', it has both 'start' and 'stop' clauses, but it never receives a termination signal, only ever a 'start' argument. In my script this is part of what I use to govern runlevels: # chkconfig: 2345 84 04 How, How, How? Just for fun, here's the script. The logging is temp!: Code:
#!/bin/bash P.S. The program i'm running is in python and catches the 'stop' functions with the 'SystemExit' exception, when invoked manually. Cheers! |
Quote:
|
Cheers, some good intel there!
I've not tried it yet, but... The tempoary logging doesn't register a shutdown call what-so-ever. If I call '/sbin/service myguard off' then all works ok and with a log entry. So I believe my prob is it getting called. I was reading last night about seperate scripts for 'chkconfig' but that seems to conflict with all the example scripts i've seen. So i'm wondering if my usage of 'chkconfig' is all it should be. I added the service using '/sbin/service myguard on', and run levels set in the script. p.s. Script actually called 'myguard' and the program 'gmon.py', sorry it's not consistent throughout these notes! |
Code:
]$ file /sbin/service Code:
# Source function library. Code:
]$ type killproc | grep success Code:
]$ declare -f success |
All times are GMT -5. The time now is 01:10 PM. |