On Thu, 2 Oct 1997, John Hoffmann wrote:
> I am writing a Tclsh server program that takes requests from a Tk client
> script and returns info on the current system/config status of the remote
> machine.
>
> It basically allows me to check/modify to remote server configuration
> without having to mount the drives as NFS partitions or use clunky CGI
> scripts (who runs their web server as root anyway? hehe).
>
> So far I can get them to pass data back and forth, but does anyone have
> any idea how I can get the remote tclsh script to run as a daemon?
Here's how I did it. This requires the TclX extension, which gives you the
"fork" command, and other nice things.
---------------------------------------
...
# become a deamon!
set pid [fork]
if {$pid != 0} {
exit
}
close stdin ; close stdout ; close stderr
# hmm, the interpreter complains if these are not open
open /dev/null r
open /dev/null w
open /dev/null w
write_file $PIDFILE [id process]
signal trap SIGUSR1 print_traffic
signal trap SIGUSR2 save_ifstats
signal trap SIGINT cleanup
# just sleep while we wait for our signals
while 1 {
sleep 600
}
=============================================================================
Keith Dart, Devtest Engineer <mailto:[EMAIL PROTECTED]>
Cisco Systems phone: +1.408.527.1391
Network to User Business Unit pager: +1.800.365.4578
web page: <http://kdart-pc2.cisco.com> fax: +1.408.527.3778
=----------------------------------------------------------------------------
MS: Where do you want to go today? Linux: been there, done that.
=============================================================================
---------------------------------------------------------------------------
To unsubscribe from the Visual Tcl mailing list, please send a message
to [EMAIL PROTECTED] with "unsubscribe vtcl [EMAIL PROTECTED]" in the
message body (where [EMAIL PROTECTED] is your e-mail address).