Commands.page Logo

Configure Aria2 Session Save Interval on Ubuntu

This guide explains how to configure the aria2 download utility on Ubuntu to automatically save session data at specific intervals. By adjusting the session save interval, you ensure that interrupted downloads can be resumed without losing progress. We will cover the specific configuration flag, where to place it, and how to verify the settings are active.

Understanding the Save Session Interval

Aria2 uses a session file to track the status of active downloads. If the application crashes or the system shuts down unexpectedly, this file allows you to resume downloads later. The --save-session-interval option determines how often, in seconds, aria2 writes this status to the disk. Setting this too high risks data loss during a crash, while setting it too low may impact performance on slow storage devices.

Editing the Configuration File

The most persistent method to set this interval is by modifying the aria2 configuration file. On Ubuntu, this file is typically located at ~/.aria2/aria2.conf. If the file does not exist, you can create it.

  1. Open the terminal.
  2. Open the configuration file using a text editor like nano: nano ~/.aria2/aria2.conf
  3. Add or modify the following line to set the interval to 60 seconds: save-session-interval=60
  4. Save the file and exit the editor.

Any new aria2 session started after this change will adhere to the new interval.

Using Command Line Arguments

If you prefer not to edit the configuration file or need a temporary setting for a specific session, you can pass the argument directly when starting aria2. This method overrides the configuration file setting for that specific run.

Run the following command in your terminal:

aria2c --save-session-interval=60 --input-file=session.txt --save-session=session.txt

Replace 60 with your desired number of seconds. This ensures the session file specified by --save-session is updated every 60 seconds during the download process.

Verifying the Configuration

To confirm that aria2 is using your desired interval, you can check the running process or observe the modification time of the session file. While aria2 is running, use the ls -l command on your session file directory. You should see the file timestamp update according to the interval you configured. Additionally, running aria2c --help | grep save-session-interval will display the default value and confirm the option is available in your installed version.