The Windows service#
On Windows the server runs as a service, so that it starts with the machine and runs with nobody logged in. This page is about that service: its name, its account, its settings and its log.
The service is installed, started and stopped from the control panel. What follows is what is behind those buttons, and how to do the same from a command prompt.
The service#
| name | CrushMFTv27 |
| shown as | "CrushMFTv27 Server" |
| starts | automatically, with Windows |
| runs | service\CrushMFTService.exe in the CrushMFT folder, which starts Java and looks after it |
| account | Local System, unless you set another |
| if it fails | Windows starts it again after a minute |
| installed before the rename | a service installed when the product was still called CrushFTP keeps its name, CrushFTPv27, with service\CrushFTPService.exe: the control panel and the server find it under that name as long as no CrushMFTv27 is installed in the folder |
The name carries the version on purpose: the service of version 11, "CrushFTP Server", is another service, and installing version 27 does not touch it.
What the service program does#
CrushMFTService.exe is small. It reads its settings, starts Java with the server, and then:
| When | It |
|---|---|
| Java ends because the server was stopped | stops the service |
| Java ends asking for a restart, as after Restart in the admin pages | starts Java again at once |
| Java ends unexpectedly | writes that to its log and starts Java again after 10 seconds, at most 5 times in 10 minutes |
| Windows shuts down, or the service is stopped | tells the server to finish, and waits. The server ends its sessions and lets running jobs finish for as long as its settings allow. Only after that time is Java ended by force. |
Everything Java writes to its output goes into the service's log.
The settings file#
service\CrushMFTService.conf, a text file of key=value lines. The control panel writes it; you can edit it. It is read again before each start of Java, so a change counts at the next restart of the service.
| Key | Is | If missing |
|---|---|---|
service_name |
the service's name | written at install: CrushMFTv27 |
display_name, description |
what Windows shows | the name |
working_dir |
the CrushMFT folder, seen from the service folder |
.. |
java |
the Java to use | looked for: java\bin\java.exe in the CrushMFT folder, then JAVA_HOME, JAVA_PATH, the PATH |
memory |
the server's most memory: megabytes, 2048, or a share of the machine's, 50% |
Java's own default |
java_params |
options for Java, as written | none |
launch_params |
what the server is started with. -d for the server; for a DMZ server -dmz 9000. |
|
log_file |
the service's log | wrapper.log beside the exe |
log_roll_size_mb |
the size at which the log starts a new file. 0: never. | 100 |
log_keep |
how many old logs are kept | 10 |
stop_timeout_secs |
how long a stop waits before Java is ended by force, until the server names its own time | 65 |
From a command prompt#
service\CrushMFTService.exe takes commands. Run it from the service folder.
| Command | Does |
|---|---|
install |
installs the service, or updates an installed one |
uninstall |
stops and removes it |
start, stop, restart |
as the names say |
status |
says whether it is installed and running |
console |
runs the server in this window, without the service. Its output shows here; Ctrl+C stops it properly. For finding out why it does not start. |
set-user DOMAIN\user file |
makes the service run as that account. The password is read from the file, and the file is deleted. The account is given the right to log on as a service. |
version, help |
Several at once work: CrushMFTService.exe install start.
The commands that change the service need an administrator. The program asks Windows for that consent by itself; there is nothing to "run as administrator".
It ends with 0 when all went well, 1 for an error, 2 when the consent was refused, 3 when the service is not installed.
Windows' own tools work as for any service: services.msc, sc query CrushMFTv27, net stop CrushMFTv27.
The account#
Local System can read and write every local disk, and reaches nothing on the network as a person would.
Give the service another account when
- users' folders are on a file server: the account needs rights there;
- your rules do not allow services under Local System.
Use an account made for the purpose, with a password that does not end. It needs to read and write the CrushMFT folder and the folders of the files. Set it with Run as account in the control panel, or set-user.
A service that does not run as an administrator can still open ports below 1024 on Windows.
The log#
service\wrapper.log: what the service program did, each line marked [launcher], and everything Java wrote to its output. It is the place to look when the service does not start or stops by itself:
- the line with which Java was started, with the memory it was given;
- Java's own complaint, if it could not start: a wrong option, a Java that is too old;
- each restart and the reason.
The server's own log is CrushMFT.log in the CrushMFT folder: Log files.
Things to know#
- The service program is not replaced by an update of the server while it runs. It is small and changes rarely.
- Several copies of CrushMFT on one machine need services with different names; the control panel warns when the installed service belongs to another copy.
- Stopping takes as long as the jobs need, up to the time set for them. A stop that seems to hang is usually a job finishing.
- Windows' own firewall is a separate matter: Install on Windows.
Not tried for this page#
The service was not installed on Windows for this page. It is written from the design and the code of the service program, whose build record says it had not been run on Windows when it was written.