Skip to content

Commit

Permalink
Add documentation for daemon mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mmgoodnow committed Sep 28, 2020
1 parent 7d01c94 commit ca67714
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ works there too.

## Usage

Invoking it is _almost_ as simple as:
Invoking `cross-seed` is _almost_ as simple as:

```shell script
npx cross-seed
Expand Down Expand Up @@ -56,6 +56,31 @@ Options:
-h, --help display help for command
```

## Daemon Mode (rtorrent only)

`cross-seed` has a new feature called daemon mode, designed to work with Docker.
It starts an HTTP server, listening on port 2468. It will respond to a POST
request with a plaintext body containing the name of a torrent inside your
torrent directory. As of right now it only works with rtorrent. I recommend
[installing the app globally](#install) if you use daemon mode.

To start the daemon, issue the following command:

```shell script
cross-seed daemon
```

Then, while the daemon is running, you can trigger a search with an HTTP
request:

```shell script
curl -XPOST http://localhost:2468 --data '<torrent name here>'
```

If you are using rtorrent, you can adapt
[these instructions](https://www.filebot.net/forums/viewtopic.php?p=5316#p5316)
to run the `curl` command on finished download.

## Install

You don't need to install this app, but if you really want to, or if your
Expand Down
12 changes: 6 additions & 6 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ const handleRequest = (config) => (req, res) => {

async function serve(config) {
const { outputDir } = config;
// try {
// await validateJackettApi(config);
// } catch (e) {
// return;
// }
try {
await validateJackettApi(config);
} catch (e) {
return;
}

fs.mkdirSync(outputDir, { recursive: true });
const server = http.createServer(handleRequest(config));
server.listen(2468);
console.log("Server is running on port 2468");
console.log("Server is running on port 2468, ^C to stop.");
}

module.exports = { serve };

0 comments on commit ca67714

Please sign in to comment.