-
Notifications
You must be signed in to change notification settings - Fork 23
[Web service] recurring commands
Hosted by laitos web server, the service hosts channels of pre-configured app commands that are run at regular interval, and let user retrieve the command results in JSON array from each channel.
While the service is online, user may add more app commands and put text messages directly into command results via an HTML form served by this service on the same HTTP endpoint. These transient commands are not memorised and will be lost upon program restart.
An example use case of the service may be to build a utility web application that displays the latest system resource usage for monitoring, or the latest list of mails in inbox.
- Under JSON key
HTTPHandlers
, write a string property calledRecurringCommandsEndpoint
, value being the URL location that will serve the configuration form and retrieve command results (both under one endpoint). Keep the location a secret to yourself and make it difficult to guess. - Under JSON key
RecurringCommandsEndpointConfig
, create an inner objectRecurringCommands
, in which keys are channel names (keep them difficult to guess) and each value is an object with the following mandatory properties:
Property | Type | Meaning |
---|---|---|
IntervalSec | integer | The interval (seconds) at which pre-configured and transient app commands should be executed. |
MaxResults | integer | The number of command results to keep. Older results are discarded. |
PreConfiguredCommands | array of strings |
Password and app commands (or shortcuts ) that will run at regular interval.
Leave empty if you do not plan for any command to run automatically, you can still add transient commands using the HTML form. |
Here is an example setup:
{ ... "HTTPHandlers": { ... "RecurringCommandEndpoint": "/very-secret-recurring-commands", "RecurringCommandEndpointConfig": { "RecurringCommands": { "my-secret-channel-alpha": { "IntervalSec": 60, "MaxResults": 10, "PreConfiguredCommands": [ "VerySecretPassword.e info", "VerySecretPassword.s date", ] }, "my-secret-channel-zulu": { "IntervalSec": 120, "MaxResults": 10, "PreConfiguredCommands": [ "VerySecretPassword.il MyEmailInbox", ] } } }, ... }, ... }
The form is hosted by web server, therefore remember to run web server.
Pre-configured commands (if any) will run periodically and automatically as soon as laitos starts up. To retrieve command results, use an HTTP client (such as web browser) to access the endpoint URL (HTTP GET):
/very-secret-recurring-commands?retrieve=my-secret-channel-alpha
The historical command results will be returned in a JSON array and then immediately deleted.
To add transient app commands, clear transient app commands, or to push messages directly into command results, visit the endpoint URL in a web browser and use the web form:
/very-secret-recurring-commands
- Make the endpoint and channel names difficult to guess, this helps to prevent misuse of the service.
- Only share the endpoint and channel names with designated users of this service, do not make them public.
Table of Contents
- Home
- Get started
- Component list
- Tips for running on public cloud
- Tips for using apps over satellite
- laitos terminal
Daemon Components
- DNS server
- Mail server
- Web server
- Web proxy server
- Telnet server
- Telegram chat-bot
- Simple IP services server
- SNMP server
- System maintenance
- Phone home telemetry
Web Service Components
- Twilio telephone/SMS hook
- Microsoft chat bot hook
- The Things Network LORA tracker integration
- Recurring commands
- App command form
- Simple app command execution API
- GitLab browser
- Temporary file storage
- Simple web proxy
- Desktop on a page (virtual machine)
- Read telemetry records
- Program health report
- System process explorer
- Prometheus metrics exporter
- HTTP request inspector
- HTTP request logger
Apps