|
f146e21…
|
drh
|
1 |
# Serving as a Standalone Server on Windows |
|
f146e21…
|
drh
|
2 |
|
|
f146e21…
|
drh
|
3 |
On Windows, this method works more or less identically to how it’s |
|
f146e21…
|
drh
|
4 |
documented in [the generic instructions](../any/none.md). |
|
f146e21…
|
drh
|
5 |
|
|
f146e21…
|
drh
|
6 |
...but only while `fossil.exe` is actually running, which is the source |
|
f146e21…
|
drh
|
7 |
of much trouble on Windows. This problem has two halves: |
|
f146e21…
|
drh
|
8 |
|
|
f146e21…
|
drh
|
9 |
|
|
f146e21…
|
drh
|
10 |
## No App Startup Without Desktop |
|
f146e21…
|
drh
|
11 |
|
|
f146e21…
|
drh
|
12 |
The easy methods for starting a program in Windows at system start all |
|
f146e21…
|
drh
|
13 |
require an interactive desktop. There is no *easy* way to start an arbitrary |
|
f146e21…
|
drh
|
14 |
program on Windows at boot before anyone has logged in. In Unix |
|
f146e21…
|
drh
|
15 |
terms, Windows has no simple equivalent to [the `/etc/rc.local` file][rcl]. |
|
f146e21…
|
drh
|
16 |
|
|
f146e21…
|
drh
|
17 |
You can partially get around the first problem by setting your `fossil |
|
f146e21…
|
drh
|
18 |
server` call up as one of the user’s interactive startup items. Windows |
|
f146e21…
|
drh
|
19 |
10 has its own [idiosyncratic way of doing this][si10], and in older |
|
f146e21…
|
drh
|
20 |
systems you have [several alternatives to this][si7]. Regardless of the |
|
f146e21…
|
drh
|
21 |
actual mechanism, these will cause the Fossil standalone HTTP server to |
|
f146e21…
|
drh
|
22 |
start on an *interactive desktop login* only. While you’re sitting at |
|
f146e21…
|
drh
|
23 |
the Windows login screen, the Fossil server is *down*. |
|
f146e21…
|
drh
|
24 |
|
|
f146e21…
|
drh
|
25 |
[rcl]: http://nixdoc.net/man-pages/FreeBSD/man8/rc.local.8.html |
|
f146e21…
|
drh
|
26 |
[si10]: https://www.tenforums.com/tutorials/2944-add-delete-enable-disable-startup-items-windows-10-a.html |
|
f146e21…
|
drh
|
27 |
[si7]: https://www.wikihow.com/Change-Startup-Programs-in-Windows-7 |
|
f146e21…
|
drh
|
28 |
|
|
f146e21…
|
drh
|
29 |
|
|
f146e21…
|
drh
|
30 |
|
|
f146e21…
|
drh
|
31 |
## No Simple Background Mode |
|
f146e21…
|
drh
|
32 |
|
|
f146e21…
|
drh
|
33 |
Windows also lacks a direct equivalent of the Bourne shell’s “`&`” control operator to |
|
f146e21…
|
drh
|
34 |
run a program in the background, which you can give in Unix’s `rc.local` |
|
f146e21…
|
drh
|
35 |
file, which is just a normal Bourne shell script. |
|
f146e21…
|
drh
|
36 |
|
|
f146e21…
|
drh
|
37 |
By “background,” I mean |
|
f146e21…
|
drh
|
38 |
“not attached to any interactive user’s login session.” When the |
|
f146e21…
|
drh
|
39 |
`rc.local` script exits in Unix, any program it backgrounded *stays |
|
f146e21…
|
drh
|
40 |
running*. There is no simple and direct equivalent to this mechanism in |
|
f146e21…
|
drh
|
41 |
Windows. |
|
f146e21…
|
drh
|
42 |
|
|
f146e21…
|
drh
|
43 |
If you set `fossil server` to run on interactive login, as above, it |
|
f146e21…
|
drh
|
44 |
will shut right back down again when that user logs back out. |
|
f146e21…
|
drh
|
45 |
|
|
f146e21…
|
drh
|
46 |
With Windows 10, it’s especially problematic because you can no longer |
|
f146e21…
|
drh
|
47 |
make the OS put off updates arbitrarily: your Fossil server will go down |
|
f146e21…
|
drh
|
48 |
every time Windows Update decides it needs to reboot your computer, and |
|
f146e21…
|
drh
|
49 |
then Fossil service will *stay* down until someone logs back into that |
|
f146e21…
|
drh
|
50 |
machine interactively. |
|
f146e21…
|
drh
|
51 |
|
|
f146e21…
|
drh
|
52 |
|
|
f146e21…
|
drh
|
53 |
## Better Solutions |
|
f146e21…
|
drh
|
54 |
|
|
f146e21…
|
drh
|
55 |
Because of these problems, we only recommend setting `fossil server` up |
|
f146e21…
|
drh
|
56 |
on Windows this way when |
|
f146e21…
|
drh
|
57 |
you’re a solo developer or you work in a small office where everyone |
|
f146e21…
|
drh
|
58 |
arrives more or less at the same time each day, and everyone goes home |
|
f146e21…
|
drh
|
59 |
about the same time each day, so that one user can keep the Fossil |
|
f146e21…
|
drh
|
60 |
server up through the working day. |
|
f146e21…
|
drh
|
61 |
|
|
f146e21…
|
drh
|
62 |
If your needs go at all beyond this, you should expect proper “server” |
|
f146e21…
|
drh
|
63 |
behavior, which you can get on Windows by [registering Fossil as a |
|
f146e21…
|
drh
|
64 |
Windows service](./service.md), which solves the interactive startup and |
|
f146e21…
|
drh
|
65 |
shutdown problems above, at a bit of complexity over the Startup Items |
|
f146e21…
|
drh
|
66 |
method. You may also want to consider putting that service behind [an |
|
f146e21…
|
drh
|
67 |
IIS front-end proxy](./iis.md) to add additional web serving features. |
|
f146e21…
|
drh
|
68 |
|
|
f146e21…
|
drh
|
69 |
*[Return to the top-level Fossil server article.](../)* |