Creating, Managing, and Configuring Services

Both asperawatchd and asperawatchfolderd are managed by asperarund, which stores asperawatchd and asperawatchfolderd configurations in its database. It automatically starts services when they are added and restarts services if they fail. It also enables admins to start services under different users without switching between accounts, and apply logging and database configurations to all services.

Similar to other Aspera services, asperarund starts automatically upon installation and runs as a system daemon (asperarund).

Configuring Services

Configuration settings for asperarund, asperawatchd, and asperawatchfolderd are located in the <server> section of aspera.conf. These can only be edited in the command line or by opening aspera.conf.

To view current service settings, run the following command and look for settings that start with rund, watch, watchd, and watchfolderd:

# /opt/aspera/bin/asuserdata -a

For more information on configuring , see:

Configuring asperarund

Logging and the Redis database used by asperarund is configured in aspera.conf:

<server>
    ...
    <rund>
        <log_level>log</log_level>
        <log_directory>AS_NULL</log_directory>
        <db_spec>redis:127.0.0.1:31415</db_spec> 
    </rund>
    <watch>
        ...
    </watch>
</server>

Run the corresponding asconfigurator command to edit a setting:

# asconfigurator -x "set_server_data;rund_log_level,log_level"
# asconfigurator -x "set_server_data;rund_log_dir,path"
# asconfigurator -x "set_server_data;rund_db_spec,db_spec"
Setting Description Default
log_level The level of detail for asperarund logging. Valid values are log, dbg1, and dbg2. log
log_directory Log to the specified directory. The Aspera logging file (Log Files).
db_spec Use the specified Redis database, which is defined with the syntax redis:ip_address:port. redis:127.0.0.1:31415 (the localhost on port 31415).

Starting asperarund

If asperarund is not running, then you cannot create Watch Folders or start a watch. The service is started automatically during installation, but you might have to start it if it was disabled or stopped.

# ps ax | grep aspera

Locate asperarund in the output. If the status is not "R", start the service:

# systemctl restart asperarund
or for Linux systems that use init.d:
# service asperarund restart

Creating Services

Both asperawatchd and asperawatchfolderd run under system users. These users must have a docroot configured for them in aspera.conf and have write permissions to the default log directory if no custom log directory is configured in aspera.conf. Aspera recommends running asperawatchd under root, and selecting a user to run asperawatchfolderd as described in Choosing User Accounts to Run Watch Folder Services. For more information, see Starting Aspera Watch Services and Creating Watches and Creating a Push Watch Folder with aswatchfolderadmin.

To start asperawatchd and asperawatchfolderd, use the GUI (Managing Services in the GUI) or run the corresponding command:

# /opt/aspera/sbin/asperawatchd --user username
# /opt/aspera/sbin/asperawatchfolderd --user username

A Watch service must be running under a user before a Watch Folders service can be created for that user.

Managing Services

Use the GUI (Managing Services in the GUI) or the asrun command line utility to view, enable, disable, or delete services.

The general syntax of asrun commands is:

# /opt/aspera/bin/asrun send [options]

Run asrun send -h to output a complete list of options.

View a list of running services

# /opt/aspera/bin/asrun send -l

The output is similar to the following:

[asrun send] code=0
{
    "services": [
         {
              "id":"52ca847a-6981-47e1-9f9b-b661cf298af1",
              "configuration": {
                     "enabled":true,
                     "run_as": {
                          "pass": "*****",
                          "user":"root"
                      },
                      "type":"WATCHD"
               },
               "state":"RUNNING",
               "state_changed_at":"2016-10-20T19:14:34Z"
          },
         {
               "id":"d109d1bd-7db7-409f-bb16-ca6ff9abb5f4",
               "configuration": {
                     "enabled":true,
                     "run_as":{
                          "pass": "*****",
                          "user":"root"
                      },
                      "type":"WATCHFOLDERD"
               },
               "state":"RUNNING",
               "state_changed_at":"2016-10-20T00:11:19Z"
           }
     ]
}

The Watch Service configuration includes the string "type":"WATCHD" and, before this entry in the output, a value for "id". The Watch Folder service includes the string: "type":"WATCHFOLDERD".

Disable a Service

Disabling a service stops the service but saves its configuration in the database. Disabled services can be restarted (enabled).

For example, to disable the asperawatchfolderd service with "id":"d109d1bd-7db7-409f-bb16-ca6ff9abb5f4":

# /opt/aspera/bin/asrun send --disable="d109d1bd-7db7-409f-bb16-ca6ff9abb5f4"
[asrun send] code=0
null

Enable a Service

Enabling a stopped service starts the service. This command can be used to restart a service that stops due to an error, without changing the configuration to trigger a reload of the configuration.

For example, to enable the asperawatchfolderd service with "id":"d109d1bd-7db7-409f-bb16-ca6ff9abb5f4":

# /opt/aspera/bin/asrun send --enable="d109d1bd-7db7-409f-bb16-ca6ff9abb5f4"
[asrun send] code=0
null

Delete a Service

Stop a service and remove its configuration from the database. A deleted service cannot be re-enabled.

Note: When deleting the asperawatchfolderd service, all existing Watch Folders started with that service are also deleted.

For example, to delete the asperawatchfolderd service with "id":"d109d1bd-7db7-409f-bb16-ca6ff9abb5f4":

# /opt/aspera/bin/asrun send --delete="d109d1bd-7db7-409f-bb16-ca6ff9abb5f4"
[asrun send] code=0
null