Перейти к основному содержанию

amuled — Headless Daemon

amuled is the headless version of aMule. It runs without any graphical interface and is designed for servers, NAS devices, or any machine where a GUI is unavailable or undesirable.

Overview​

amuled is a fully featured aMule client with the GUI stripped out. Without the graphical layer it has significantly reduced memory and CPU requirements and can run without an X server entirely. It is controlled exclusively through remote interfaces:

  • amulegui — graphical remote GUI (same interface as amule)
  • amuleapi — REST API + browser Web UI daemon (the modern replacement for amuleweb)
  • amulecmd — command-line interface
  • amuleweb — browser-based HTTP interface

All remote interfaces communicate with amuled through the External Connections (EC) protocol on TCP port 4712 (configurable).

Command-Line Options​

amuled accepts the following options:

ShortLongDescription
-v--versionDisplay the current version number and exit.
-h--helpDisplay the list of options and exit.
-c <dir>--config-dir=<dir>Read the configuration from <dir> instead of the default ~/.aMule/.
-o--log-stdoutPrint log messages to stdout (ignored when the daemon forks to background).
-r--reset-configReset the configuration to default values (the old config is backed up with a .backup suffix).
-e--ec-configConfigure External Connections (EC) interactively.
-f--full-daemonFork to background (daemonize). Without this flag amuled stays in the foreground.
-p <file>--pid-file=<file>After forking, write the daemon's PID to <file> so a service manager can track it.
-w <path>--use-amuleweb=<path>Specify the location of the amuleweb binary.
-i--enable-stdinDo not close stdin (closed by default). Not available on Windows.
-d--disable-fatalDon't catch fatal exceptions or block exit on assertions (useful under systemd / watchdog scripts). Not available on Windows.
-t <n>--category=<n>Set the category for passed eD2k links.
--configure-autostart=on|offEnable or disable starting amuled on user login, then exit. The OS-specific store is selected automatically: Windows registry Run key, macOS LaunchAgent, Linux/BSD XDG .desktop autostart entry. On a headless server, use a system service instead. See Starting aMule Automatically.
--configure-protocols=<value>Enable or disable aMule as the current user's default handler for ed2k:// and magnet: links, then exit. <value> is on or off for both schemes, or ed2k:on, ed2k:off, magnet:on or magnet:off for one of them. The OS-specific store is selected automatically: Windows registry, macOS LaunchServices, Linux/BSD XDG mimeapps.list.
--configure-file-assoc=on|offEnable or disable aMule as the current user's handler for .emulecollection files, then exit. Uses the same OS-specific stores as --configure-protocols.

One or more links may be passed as positional arguments: an eD2k file link is added to the download queue, an eD2k server or serverlist link to the server list, and a magnet link (it must contain the eD2k hash and file length) to the download queue. The argument can also be the path to an .emulecollection file, or a file:// URL naming one, in which case every link it contains is added to the download queue.

примечание

Do not set an excessively high MaxConnections value in amule.conf. The default is around 500 and amuled adapts the recommended maximum to your operating system's capabilities. Setting it far too high wastes resources and can degrade performance.

Installation​

See Installation for pre-built packages, or Compilation to build amuled from source.

Configuration​

First Run​

Start amuled once with the --ec-config flag to configure External Connections interactively:

amuled --ec-config

Alternatively, run amuled once normally — it will create ~/.aMule/amule.conf with defaults — then quit and edit the file manually.

Key amule.conf Settings​

The relevant section is [ExternalConnect]:

[ExternalConnect]
AcceptExternalConnections=1
ECPassword=56f491c56340a6fa5c158863c6bfb39f
ECPort=4712

Generating the ECPassword hash:

echo -n yourpassword | md5sum | cut -d ' ' -f 1

Copy the output (without trailing whitespace) into ECPassword.

By default, a new configuration listens for EC connections on the local machine only (ECAddress=127.0.0.1); an amule.conf created by an older version keeps the value it already had (usually empty = all interfaces). To accept EC connections from other machines, clear the address (empty = listen on all interfaces) or set it to the IP address of one local interface:

ECAddress=

Starting amuled​

By default amuled runs in the foreground. Add -o to print log messages to stdout:

amuled -o

Use -f to fork to the background (daemonize). When it forks, amuled detaches from the controlling terminal and closes stdin/stdout/stderr, so logging to stdout is disabled automatically. Combine it with -p to write a PID file that a service manager can track:

amuled -f -p /run/amuled/amuled.pid
примечание

aMule creates a single-instance lock at ~/.aMule/muleLock to prevent a second instance from starting with the same configuration. This is not a manageable PID file — use -p if you need one.

Verify Local Data​

Verify Local Data re-hashes a shared file's on-disk data against the MD4 (and, when a hashset is available, AICH) hashes aMule has stored for it, to detect data that no longer matches. amuled has no interface of its own, so the operation is requested by a remote interface and run by the daemon:

The result is written to the daemon log (read it with amulecmd -c "show log"), as Verify Local Data (MD4 & AICH): Result OK for <path> or Verify Local Data (MD4 & AICH): ERRORS FOUND! <path> Failed blocks: … ((MD4) instead of (MD4 & AICH) when no AICH hashset was checked). A file that cannot be checked (for example, one that is still downloading) is skipped with a log line explaining why. amulecmd has no command for this operation.

Running as a System Service​

On modern Linux distributions the init system is systemd, so that is the recommended way to run amuled unattended; Gentoo uses OpenRC instead.

совет

Many distributions package amuled with a ready-made service (for example Debian/Ubuntu's amule-daemon package). If you installed aMule through your package manager, use that service instead of writing your own.

systemd (modern Linux)​

Create /etc/systemd/system/amuled.service:

[Unit]
Description=aMule Daemon
After=network.target

[Service]
Type=simple
User=amule
ExecStart=/usr/bin/amuled -o -d
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
примечание

Do not pass -f here. With Type=simple, systemd expects amuled to stay in the foreground; forking to background would make systemd lose track of the process. Run it in the foreground with -o so log messages go to the journal, and -d so it behaves well under the service manager. (If you prefer the classic forking style, use Type=forking, ExecStart=/usr/bin/amuled -f -p /run/amuled/amuled.pid and PIDFile=/run/amuled/amuled.pid instead.)

Enable and start:

systemctl enable amuled
systemctl start amuled

Replace User=amule with the name of a user that has already run amule or amuled once to generate a configuration.

Gentoo (OpenRC)​

Save the following as /etc/init.d/amuled and make it executable (chmod 755 /etc/init.d/amuled):

#!/sbin/openrc-run

name="amuled"
description="aMule Daemon"
command="/usr/bin/amuled"
command_args="-o -d"
command_user="amule" # A user that has run amule once to configure it.
command_background="yes"
pidfile="/run/amuled.pid"

depend() {
need net
}

OpenRC runs amuled in the foreground (-o -d) and handles backgrounding and the PID file itself (command_background). Enable and start it with:

rc-update add amuled default
rc-service amuled start

Connecting Remotely​

Once amuled is running with EC enabled, connect to it using any of the remote interfaces:

InterfaceCommand / URL
GUIamulegui
REST / Web UIhttp://hostname:4713 (after starting amuleapi)
CLIamulecmd -h hostname -p 4712 -P yourpassword
Webhttp://hostname:4711 (after starting amuleweb)

See the individual pages for amulegui, amuleapi, amulecmd, and amuleweb for full setup instructions.

To connect from another machine, make sure the EC port (and the amuleweb HTTP port, if used) is reachable: see Network Connectivity for the full list of ports and Firewall for how to open them.