The Linux service#
On Linux the server is started and stopped by one script in its folder, crushmft_init.sh, which also makes the service that starts it with the machine. This page is about that script and the service.
The first steps are in Install on Linux.
The commands#
| Command | Does | Needs root |
|---|---|---|
crushmft_init.sh start |
starts the server in the background. A running one is stopped first. | when the server runs as another account than yours |
crushmft_init.sh stop |
tells the server to finish, and waits up to STOP_WAIT seconds |
the same |
crushmft_init.sh restart |
stop, then start | the same |
crushmft_init.sh status |
says whether the server runs, and whether the service is installed | no |
crushmft_init.sh info |
shows the system, its memory, the kind of service, the Java it would use and its version, the Java options, the open files limit, the folder and the account | no |
crushmft_init.sh install |
makes the service, turns it on for every boot, and starts the server | yes |
crushmft_init.sh uninstall |
stops the service and removes it. The CrushMFT folder is left as it is. | yes |
crushmft_init.sh run |
runs the server in the foreground. This is what the systemd service runs; by hand it is for seeing the server's output directly. |
The script finds a running server by looking at the list of processes, not by a file with a number in it. So it is right however the server was started.
The service it makes#
INIT_SYSTEM in the script decides the kind. Left at auto, the script looks at the system.
| Kind | What install makes |
You then use |
|---|---|---|
systemd |
the unit /etc/systemd/system/crushmft.service |
systemctl start crushmft, stop, status; journalctl -u crushmft for the output |
sysv |
a link in /etc/init.d/ to the script, registered with chkconfig or update-rc.d |
service crushmft start, and so on |
bsd |
a file in /etc/rc.d/ |
the system's service command, and its enable switch in rc.conf |
The service is always named crushmft. The server relies on that name to restart itself. A service installed before the product was named CrushMFT is called crushftp: it keeps that name, and the script and the server use it while no crushmft service is installed.
Under systemd, Java runs as the service's own process. systemd therefore sees how it ended, and starts it again after a crash.
The account#
CRUSH_USER in the script. root can start and stop the server whatever is set there; the server is then started as that account.
| Run as | For | Against |
|---|---|---|
root, as delivered |
ports below 1024 work; every folder can be reached | a fault in the server, or a job that runs a program, has every right on the machine |
| an account of its own | the server can touch only what you gave that account | it cannot open ports below 1024: use high ports and redirect. It must own the CrushMFT folder and be able to read and write the users' files. |
To change: stop the server, set CRUSH_USER, give the folder to the account (chown -R), start it. After a change of CRUSH_USER, run install again so that the service is made anew.
Jobs that start programs, and folders of users, act with the rights of this account. An account of its own is the safer choice for a server on the internet.
Open files#
MAX_OPEN_FILES, 16000 as delivered, is the most files and connections the server may hold at once. The script raises the limit for the server at each start. If the system does not allow that much: "Warning: could not allow 16000 open files, the limit stays …". Then raise the system's own limit, or the server will refuse connections when it is busy.
Where the output goes#
| Started by | The server's output is in |
|---|---|
| the systemd service | the journal: journalctl -u crushmft |
start by hand, or a sysv service |
nohup.out in the CrushMFT folder |
run |
your terminal |
What matters day to day is not the output but the server's log, CrushMFT.log in the CrushMFT folder: Log files. The output matters when the server does not start at all.
Stopping#
stop asks the server to finish and waits up to STOP_WAIT seconds, 60 as delivered. The server ends its sessions and gives running jobs time. On a server with long jobs, raise STOP_WAIT, or a stop may cut a job short.
The admin pages can also stop and restart the server: a restart from there has the service start it again.
Changing the settings#
Memory and Java options are the line JAVA_OPTS: see Java and memory settings. The memory setting of the admin pages rewrites the first option of that line.
A change in the script counts at the next start. For changes to CRUSH_USER, CRUSH_DIR or INIT_SYSTEM, run install again.
A DMZ server#
The same script runs a DMZ server: set START_ARGS="-dmz 9000", with the port the internal server will connect to. See DMZ.
FIPS mode#
Add -Dcrushmft.fips=true to JAVA_OPTS. If FIPS mode cannot start, the server ends at once with code 78; the script says why, and the service does not try again. java -jar CrushMFT.jar -FIPS_CHECK in the folder lists what is missing. See FIPS mode.
Things to know#
- Edit the script in the CrushMFT folder, not a copy elsewhere. The service points at that one.
- An update of the server may bring a newer script. Note your settings from the top of the file before an update, and compare afterwards.
- Two servers on one machine need two folders, and their services cannot both be named
crushftp: run the second from its own unit that calls its script withrun. - SELinux and similar may stop a service from opening ports or reading folders outside its usual places. The system's audit log says so.
Not tried for this page#
The script was not run for this page. What it does is read from the script itself.