How to stop aria2 download after a certain time

This article provides a direct answer to stopping an aria2 download automatically after a specific duration has passed. You will learn the exact command-line parameter required, its proper syntax, and practical examples to implement this time-limit feature in your download workflows.

The specific command parameter that allows aria2 to stop downloading after a certain amount of time has elapsed is --stop. This parameter accepts a relative time value, telling the aria2 process to terminate completely once that specified duration has reached zero.

The --stop Parameter Syntax

When using this parameter, you define the time limit using a number followed by a unit identifier. The supported time units are:

  • s for seconds
  • m for minutes
  • h for hours

Practical Examples

If you want to limit a download to exactly 30 minutes, you would append the parameter to your command like this:

aria2c --stop=30m "https://example.com/largefile.zip"

For a strict time limit of 2 hours, the command structure looks like this:

aria2c --stop=2h "https://example.com/movie.mp4"

Key Considerations

  • Incomplete Downloads: When the specified time elapses, aria2 will stop the process regardless of whether the file has finished downloading.
  • Resuming Later: Because aria2 supports download resumption, you can run the command again later without losing the progress made during the timed session, provided the server supports resume capabilities.
  • Alternative Parameters: Do not confuse --stop with --max-overall-download-limit, which limits download speed rather than the actual time elapsed, or --timeout, which controls how long aria2 waits for a sluggish network connection before giving up.