Check-in [5a2587b0a6]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Updated the "notify-server" to run in the foreground if Tclx is not available.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5a2587b0a6c62b26177f132afcba32f43bd7e448
User & Date: rkeene 2006-03-12 09:21:37
Context
2006-03-13
10:19
BackupPCd 0.1.3 Added "--with-notifyserv" and "--with-updateurl" configuration options to hard-code their respective parameters as defaults into the resulting executable. check-in: 9164d12258 user: rkeene tags: trunk
2006-03-12
09:21
Updated the "notify-server" to run in the foreground if Tclx is not available. check-in: 5a2587b0a6 user: rkeene tags: trunk
02:10
Added a "gethostname()" replacement Added "backuppcd_notify()" and related code. No authentication is currently present. Created a small example "notify-server" in Tcl. This server just manipulates the "/etc/hosts" file. check-in: 0d7a0b3376 user: rkeene tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tools/notify-server.

1
2
3
4
5
6
7
8
9
10
11
12
#! /usr/bin/tclsh

package require Tclx

set BackupPCdNotifyServerPort 1899
set Hostfile "/etc/hosts"

proc handle_connection {sock addr port} {
	fileevent $sock readable [list handle_data $sock $addr $port]

	return
}


<
<
|







1
2


3
4
5
6
7
8
9
10
#! /usr/bin/tclsh



set BackupPCdNotifyServerPort 899
set Hostfile "/etc/hosts"

proc handle_connection {sock addr port} {
	fileevent $sock readable [list handle_data $sock $addr $port]

	return
}
168
169
170
171
172
173
174









175
176
177
178
179
180
181

}

if {![info exists servfd]} {
	puts $err
	exit 1
}










# Become a daemon
if {[fork] == 0} {
	if {[fork] == 0} {
		cd /
		vwait forever
	}
}








>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
>
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
}

if {![info exists servfd]} {
	puts $err
	exit 1
}

if {[catch {
	package require Tclx
}]} {
	puts stderr "Error loading the \"Tclx\" package, we cannot become a daemon."
	puts stderr "Running in the foreground."
	puts stderr "$errorInfo"

	vwait forever
} else {
	# Become a daemon
	if {[fork] == 0} {
		if {[fork] == 0} {
			cd /
			vwait forever
		}
	}
}