File: external_command_activity_scripts.rst

package info (click to toggle)
autosuspend 9.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,196 kB
  • sloc: python: 5,431; xml: 13; makefile: 10; javascript: 1
file content (29 lines) | stat: -rw-r--r-- 1,001 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
.. _external-command-activity-scripts:

External command scripts for activity detection
###############################################

A collection of user-provided scripts to use with the :ref:`check-external-command` check for activity detection.

pyLoad
******

`pyLoad <https://pyload.net/>`__ uses an uncommon login theme for its API and hence two separate requests are required to query for active downloads.
Use something along the following lines to query pyLoad.

.. code-block:: bash

   #!/bin/bash

   SessionID=$(curl -s "http://127.0.0.1:8000/api/login" -g -H "Host: 127.0.0.1:8000" -H "Content-Type: application/x-www-form-urlencoded" --data "username=user&password=password" | jq -r)

   SessionStatus=$(curl -s  "http://127.0.0.1:8000/api/statusServer" -g -H "Host: 127.0.0.1:8000" -H "Content-Type: application/x-www-form-urlencoded" --data "session=$SessionID" | jq -r '.active')

   if [ $SessionStatus -eq 1 ]
   then
     exit 0
   else
     exit 1
   fi

Source: :issue:`102`