Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: making a perl script TSR? (on linux)

by Roger (Parson)
on Aug 20, 2005 at 00:35 UTC ( #485337=note: print w/replies, xml ) Need Help??


in reply to making a perl script TSR? (on linux)

Have a look at the module Net::Server, it has pretty much all you need to write a network server daemon.

Should you want to kill your daemon cleanly, create a signal handler in the daemon that does a graceful shutdown, and have the program, when you run with '-k' flag, to send a signal to the daemon, which then initiates the shutdown procedure.

You may also want to look at modules like Unix::Process (really just ps -ef) to discover the PID of the daemon process.

You can also create a /var/lock/myserver.lock file as well when the server first goes TSR, that contains the PID of the server process. The program later (in kill mode) will read this file to get the PID, validate the PID using Unix::Process to make sure it is still running, then send the kill signal to the server to initiate a clean shutdown.

  • Comment on Re: making a perl script TSR? (on linux)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://485337]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2022-12-05 10:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?