### Install Cronicle Manually Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Setup.md Manually installs Cronicle by downloading the source, installing dependencies, and building the distribution. Replace `v1.0.0` with the desired version or `master` for the latest unstable version. ```bash mkdir -p /opt/cronicle cd /opt/cronicle curl -L https://github.com/jhuckaby/Cronicle/archive/v1.0.0.tar.gz | tar zxvf - --strip-components 1 npm install node bin/build.js dist ``` -------------------------------- ### Install Build Tools on RedHat/Fedora/CentOS Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Development.md Installs necessary build tools for development on RedHat-based systems. ```bash yum install gcc-c++ make ``` -------------------------------- ### Install Build Tools on Debian/Ubuntu Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Development.md Installs essential build tools required for development on Debian-based systems. ```bash apt-get install build-essential ``` -------------------------------- ### HTTP Request Placeholder Expansion Example (Headers) Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Plugins.md This example illustrates placeholder expansion within the HTTP request headers. It shows how a header value is dynamically set using data from a previous response's headers. ```text User-Agent: Mozilla/5.0 X-UUID: 7617a494-823f-4566-8f8b-f479c2a6e707 ``` -------------------------------- ### HTTP Request Placeholder Expansion Example (URL) Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Plugins.md This example shows how a placeholder in the URL field of a subsequent HTTP Request is expanded using data from a previous response's chain data. The URL resolves to include a value from the previous JSON response body. ```text http://myserver.com/test.json?key=value1 ``` -------------------------------- ### Run Event Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md Immediately starts an on-demand job for an event, regardless of its schedule. This is equivalent to clicking the 'Run Now' button in the UI. API Keys require the `run_events` privilege. Both HTTP GET (query string) or HTTP POST (JSON data) are acceptable. ```APIDOC ## run_event ### Description This endpoint immediately starts an on-demand job for a specified event, bypassing its regular schedule. It's functionally identical to the 'Run Now' action in the user interface. Access to this API requires the `run_events` privilege for API Keys. ### Method GET or POST ### Endpoint `/api/app/run_event/v1` ### Parameters #### Query Parameters (for GET requests) or JSON Body (for POST requests) - **id** (string) - Required - The unique identifier of the event to run. - **title** (string) - Required - The exact, case-sensitive title of the event to run. Any properties from the [Event Data Object](APIReference.md#event-data-format) can be included to customize job settings. Properties not specified will inherit values from the event object. ### Request Example (JSON POST) ```json { "id": "3c182051" } ``` ### Request Example (Customized JSON POST) ```json { "id": "3c182051", "category": "43f8c57e", "cpu_limit": 100, "cpu_sustain": 0, "detached": 0, "log_max_size": 0, "max_children": 1, "memory_limit": 0, "memory_sustain": 0, "multiplex": 0, "notify_fail": "", "notify_success": "", "params": { "db_host": "idb01.mycompany.com", "verbose": 1, "cust": "Marketing" }, "plugin": "test", "retries": 0, "retry_delay": 30, "target": "db1.internal.myserver.com", "timeout": 3600, "title": "DB Reindex", "username": "admin", "web_hook": "http://myserver.com/notify-chronos.php" } ``` ### Response #### Success Response (200) - **code** (integer) - 0 indicates success. - **ids** (array of strings) - An array containing the IDs of all launched jobs. Typically one, but can be multiple for multiplexed events. - **queue** (integer, optional) - The number of jobs currently queued, if 'Allow Queued Jobs' is enabled. ### Response Example ```json { "code": 0, "ids": ["23f5c37f", "f8ac3082"] } ``` **Advanced Tip:** To prevent merging POST data into `params` (e.g., when using a webhook that provides JSON data), append `&post_data=1` to the query string. The POST data will then be available under the `post_data` key within the `params` object. ``` -------------------------------- ### Start Cronicle in Debug Mode as Primary Server Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Development.md Forces Cronicle to become the primary server immediately upon startup, allowing immediate use of the web app. Do not use this switch on multiple servers in a cluster; for multi-server setups, wait for Cronicle to elect a primary automatically. ```bash ./bin/debug.sh --master ``` -------------------------------- ### Install Cronicle Automatically Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Setup.md Installs the latest stable release of Cronicle and its dependencies. Run this command as root. ```bash curl -s https://raw.githubusercontent.com/jhuckaby/Cronicle/master/bin/install.js | node ``` -------------------------------- ### Example Cronicle API Call URL Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md An example of a full URL for a Cronicle API call, specifying the server, port, and function. ```bash http://myserver.com:3012/api/app/get_schedule/v1 ``` -------------------------------- ### Manual Installation of Latest Dev Build Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Development.md Clones the latest development version of Cronicle, installs dependencies, and builds the development version. This keeps all JavaScript and CSS unobfuscated. ```bash git clone https://github.com/jhuckaby/Cronicle.git cd Cronicle npm install node bin/build.js dev ``` -------------------------------- ### PHP Plugin Example Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Plugins.md A sample PHP plugin demonstrating how to read job data from stdin, report progress, and signal completion. ```php #!/usr/bin/env php 0.5 )) . "\n" ); sleep(5); print( "Job complete, exiting.\n" ); // All done, send completion via JSON print( json_encode(array( 'complete' => 1, 'code' => 0 )) . "\n" ); exit(0); ?> ``` -------------------------------- ### Setup Cronicle Storage and Admin User Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Setup.md Initializes the storage system and creates an administrator account. This command should only be run once on the primary server. ```bash /opt/cronicle/bin/control.sh setup ``` -------------------------------- ### Example Discord Webhook URL Source: https://github.com/jhuckaby/cronicle/wiki/Discord-Webhook-Integration This is an example of a Discord Webhook URL. Replace this with your actual webhook URL. ```text https://discord.com/api/webhooks/10984376568262/raHD8YolEM-d6jG1Ru4CwbVbG-nm-Me2DHGW0XE ``` -------------------------------- ### Install Couchbase Module Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Configuration.md Install the Couchbase npm module, specifically version 2.6.12, as required by Cronicle. ```bash cd /opt/cronicle npm install couchbase@2.6.12 ``` -------------------------------- ### Node.js Plugin Example Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Plugins.md A sample Node.js plugin that reads job details from stdin, reports progress, and signals completion. ```javascript #!/usr/bin/env node var rl = require('readline').createInterface({ input: process.stdin }); rl.on('line', function(line) { // got line from stdin, parse JSON var job = JSON.parse(line); console.log("Running job: " + job.id + ": " + JSON.stringify(job) ); // Update progress at 50% setTimeout( function() { console.log("Halfway there!"); process.stdout.write( JSON.stringify({ progress: 0.5 }) + "\n" ); }, 5 * 1000 ); // Write completion to stdout setTimeout( function() { console.log("Job complete, exiting."); process.stdout.write( JSON.stringify({ complete: 1, code: 0 }) + "\n" ); }, 10 * 1000 ); // close readline interface rl.close(); }); ``` -------------------------------- ### Proxy Protocol Examples Source: https://github.com/jhuckaby/cronicle/wiki/Proxy-Servers Cronicle supports various proxy protocols, including http, https, socks, and pac files. Examples show the expected URL format for each. ```text http://proxy-server-over-tcp.com:3128 ``` ```text https://proxy-server-over-tls.com:3129 ``` ```text socks://username:password@some-socks-proxy.com:9050 ``` ```text socks5://username:password@some-socks-proxy.com:9050 ``` ```text socks4://some-socks-proxy.com:9050 ``` ```text pac+http://www.example.com/proxy.pac ``` -------------------------------- ### Example Cronicle Server Group JSON Source: https://github.com/jhuckaby/cronicle/wiki/Troubleshooting This is an example JSON structure for Cronicle server groups, illustrating the `id`, `title`, `regexp`, and `master` properties. The `regexp` is used to match hostnames, and `master` indicates if the group can host a master server. ```json { "type": "list_page", "items": [ { "id": "allgrp", "title": "All Servers", "regexp": ".+", "master": 0 }, { "id": "mastergrp", "title": "Master Group", "regexp": "(dev01|dev02|devrelease|mtx\d+)\\.", "master": 1 } ] } ``` -------------------------------- ### API Key Example Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md A randomly generated hexadecimal string representing a Cronicle API key. ```text 0095f5b664b93304d5f8b1a61df605fb ``` -------------------------------- ### HTTP Request Plugin Chain Data Example Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Plugins.md This example demonstrates the structure of data passed into the chain data object from an HTTP response. It includes response headers and, if applicable, parsed JSON body content. ```json "chain_data": { "headers": { "date": "Sat, 14 Jul 2018 20:14:01 GMT", "server": "Apache/2.4.28 (Unix) LibreSSL/2.2.7 PHP/5.6.30", "last-modified": "Sat, 14 Jul 2018 20:13:54 GMT", "etag": "\"2b-570fb3c47e480\"", "accept-ranges": "bytes", "content-length": "43", "connection": "close", "content-type": "application/json", "x-uuid": "7617a494-823f-4566-8f8b-f479c2a6e707" }, "json": { "key1": "value1", "key2": 12345 } } ``` -------------------------------- ### Complex Schedule Example Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md Define a complex, multi-faceted schedule for a job. This example runs only in 2015, during March-May, on the 1st and 15th of the month (if it's a weekday), between 6 AM and 10 AM, specifically at the 15th and 45th minute of those hours. ```javascript { "years": [2015], "months": [3, 4, 5], "days": [1, 15], "weekdays": [1, 2, 3, 4, 5], "hours": [6, 7, 8, 9, 10], "minutes": [15, 45] } ``` -------------------------------- ### Configure Filesystem Storage Source: https://github.com/jhuckaby/cronicle/blob/master/docs/InnerWorkings.md Example configuration for using local filesystem storage with Cronicle. Ensure the 'base_dir' points to your NFS mount if using a shared filesystem. ```json { "Storage": { "engine": "Filesystem", "list_page_size": 50, "concurrency": 4, "Filesystem": { "base_dir": "/PATH/TO/YOUR/NFS/MOUNT", "key_namespaces": 1 } } } ``` -------------------------------- ### Run Event On Demand - Customized Request Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md This example shows how to customize various settings for a job when running an event on demand. Omitted properties are pulled from the event object. API Keys require the `run_events` privilege. ```json { "id": "3c182051", "category": "43f8c57e", "cpu_limit": 100, "cpu_sustain": 0, "detached": 0, "log_max_size": 0, "max_children": 1, "memory_limit": 0, "memory_sustain": 0, "multiplex": 0, "notify_fail": "", "notify_success": "", "params": { "db_host": "idb01.mycompany.com", "verbose": 1, "cust": "Marketing" }, "plugin": "test", "retries": 0, "retry_delay": 30, "target": "db1.internal.myserver.com", "timeout": 3600, "title": "DB Reindex", "username": "admin", "web_hook": "http://myserver.com/notify-chronos.php" } ``` -------------------------------- ### Complete S3 Compatible Service Configuration Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Configuration.md A full configuration example for using an S3-compatible service with Cronicle, including endpoint details and credentials. ```json { "Storage": { "transactions": true, "trans_auto_recover": true, "engine": "S3", "AWS": { "endpoint": "http://minio:9000", "endpointPrefix": false, "forcePathStyle": true, "hostPrefixEnabled": false, "region": "us-west-1", "credentials": { "accessKeyId": "YOUR_MINIO_ACCESS_KEY", "secretAccessKey": "YOUR_MINIO_SECRET_KEY" } }, "S3": { "connectTimeout": 5000, "socketTimeout": 5000, "maxAttempts": 50, "keyPrefix": "", "fileExtensions": true, "params": { "Bucket": "YOUR_MINIO_BUCKET_ID" }, "cache": { "enabled": true, "maxItems": 1000, "maxBytes": 10485760 } } } } ``` -------------------------------- ### Example Email Template Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Configuration.md This is an example of a plain text email template file used by Cronicle. It includes various placeholders that are replaced with live data when an email is sent. You can customize these templates to change the content and format of notifications. ```text To: [/notify_success] From: [/config/email_from] Subject: Cronicle Job Completed Successfully: [/event_title] Date/Time: [/nice_date_time] Event Title: [/event_title] Category: [/category_title] Server Target: [/nice_target] Plugin: [/plugin_title] Job ID: [/id] Hostname: [/hostname] PID: [/pid] Elapsed Time: [/nice_elapsed] Performance Metrics: [/perf] Avg. Memory Usage: [/nice_mem] Avg. CPU Usage: [/nice_cpu] Job Details: [/job_details_url] Job Debug Log ([/nice_log_size]): [/job_log_url] Edit Event: [/edit_event_url] Description: [/description] Event Notes: [/notes] Regards, The Cronicle Team ``` -------------------------------- ### Start Cronicle Service Source: https://github.com/jhuckaby/cronicle/wiki/Troubleshooting After making configuration changes or repairs, restart the Cronicle service on all master servers. ```bash /opt/cronicle/bin/control.sh start ``` -------------------------------- ### Perl Plugin Example Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Plugins.md A sample Perl plugin that processes job JSON from stdin, reports progress, and exits with a status code. ```perl #!/usr/bin/env perl use strict; use JSON; # set output autoflush $| = 1; # read line from stdin -- it should be our job JSON my $line = ; my $job = decode_json($line); print "Running job: " . $job->{id} . ": " . encode_json($job) . "\n"; # report progress at 50% sleep 5; print "Halfway there!\n"; print encode_json({ progress => 0.5 }) . "\n"; sleep 5; print "Job complete, exiting.\n"; # All done, send completion via JSON print encode_json({ complete => 1, code => 0 }) . "\n"; exit(0); 1; ``` -------------------------------- ### Plugin Job Input JSON Example Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Plugins.md This JSON document is piped to a plugin's STDIN when a job is launched. It describes the job details, including ID, hostname, command, event, timestamp, log file path, and custom parameters. ```json { "id": "jihuxvagi01", "hostname": "joeretina.local", "command": "/usr/local/bin/my-plugin.js", "event": "3c182051", "now": 1449431125, "log_file": "/opt/cronicle/logs/jobs/jihuxvagi01.log", "params": { "myparam1": "90", "myparam2": "Value" } } ``` -------------------------------- ### Example Email Notification Content Source: https://github.com/jhuckaby/cronicle/blob/master/docs/WebUI.md This is an example of the detailed email content sent by Cronicle upon job completion, including success or failure status. It contains information about the event, job, server, plugin, performance metrics, and any errors encountered. ```text To: ops@local.cronicle.com From: notify@local.cronicle.com Subject: Cronicle Job Failed: Rebuild Indexes Date/Time: 2015/10/24 19:47:50 (GMT-7) Event Title: Rebuild Indexes Category: Database Server Target: db01.prod Plugin: DB Indexer Job ID: jig5wyx9801 Hostname: db01.prod PID: 4796 Elapsed Time: 1 minute, 31 seconds Performance Metrics: scale=1&total=30.333&db_query=1.699&db_connect=1.941&log_read=2.931&gzip_data=3.773 Memory Usage: 274.5 MB Avg, 275.1 MB Peak CPU Usage: 31.85% Avg, 36.7% Peak Error Code: 999 Error Description: Failed to write to file: /backup/db/schema.sql: Out of disk space Job Details: http://local.syncronic.com:3012/#JobDetails?id=jig5wyx9801 Job Debug Log (18.2 K): http://local.syncronic.com:3012/api/app/get_job_log?id=jig5wyx9801 Edit Event: http://local.syncronic.com:3012/#Schedule?sub=edit_event&id=3c182051 Event Notes: This event handles reindexing our primary databases nightly. Contact Daniel in Ops for details. Regards, The Cronicle Team ``` -------------------------------- ### Configure Storage Migration Source: https://github.com/jhuckaby/cronicle/blob/master/docs/CommandLine.md Modify your config.json to define both the current and new storage configurations. This example shows migration from local filesystem to Amazon S3. ```json { "Storage": { "engine": "Filesystem", "Filesystem": { "base_dir": "data", "key_namespaces": 1 } }, "NewStorage": { "engine": "S3", "AWS": { "accessKeyId": "YOUR_AMAZON_ACCESS_KEY", "secretAccessKey": "YOUR_AMAZON_SECRET_KEY", "region": "us-west-1", "correctClockSkew": true, "maxRetries": 5, "httpOptions": { "connectTimeout": 5000, "timeout": 5000 } }, "S3": { "keyPrefix": "cronicle", "fileExtensions": true, "params": { "Bucket": "YOUR_S3_BUCKET_ID" } } } } ``` -------------------------------- ### Cronicle API Endpoint Example Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md The main API endpoint for Cronicle. Replace NAME with the specific API function. ```bash /api/app/NAME/v1 ``` -------------------------------- ### Restart Cronicle Service Source: https://github.com/jhuckaby/cronicle/blob/master/docs/CommandLine.md This command performs a quick stop followed by a start of the Cronicle service. Check the script path. ```bash /opt/cronicle/bin/control.sh restart ``` -------------------------------- ### Run Twice Daily Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md Schedule a job to execute twice a day at specific times. This example runs at 4:30 AM and 4:30 PM by specifying the desired hours and minutes. ```javascript { "hours": [4, 16], "minutes": [30] } ``` -------------------------------- ### Configure Mail Options with Nodemailer Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Configuration.md Set specific mailer options for pixl-mail, which are passed to Nodemailer. This includes options for secure connections, authentication, and various timeouts. Examples show both SSL/authentication and sendmail configurations. ```json "mail_options": { "secure": true, "auth": { "user": "fsmith", "pass": "12345" }, "connectionTimeout": 10000, "greetingTimeout": 10000, "socketTimeout": 10000 } ``` ```json "mail_options": { "sendmail": true, "newline": "unix", "path": "/usr/sbin/sendmail" } ``` -------------------------------- ### Shell Plugin - Basic Exit Status Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Plugins.md Example of a shell script plugin that uses exit codes to indicate success or failure. Non-zero exit codes signal an error. ```bash #!/bin/bash # Perform tasks or die trying... /usr/local/bin/my-task-1.bin || exit 1 /usr/local/bin/my-task-2.bin || exit 1 /usr/local/bin/my-task-3.bin || exit 1 ``` -------------------------------- ### Create Event API Request Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md Use this endpoint to create a new event and add it to the schedule. API Keys require the `create_events` privilege. Only HTTP POST (JSON data) is acceptable. The example shows a comprehensive set of parameters including timing and plugin-specific parameters. ```json { "catch_up": 1, "category": "43f8c57e", "cpu_limit": 100, "cpu_sustain": 0, "detached": 0, "enabled": 1, "log_max_size": 0, "max_children": 1, "memory_limit": 0, "memory_sustain": 0, "modified": 1451185588, "multiplex": 0, "notes": "This event handles database maintenance.", "notify_fail": "", "notify_success": "", "params": { "db_host": "idb01.mycompany.com", "verbose": 1, "cust": "Sales" }, "plugin": "test", "retries": 0, "retry_delay": 30, "target": "db1.int.myserver.com", "timeout": 3600, "timezone": "America/New_York", "timing": { "hours": [ 21 ], "minutes": [ 20, 40 ] }, "title": "DB Reindex", "web_hook": "http://myserver.com/notify-chronos.php" } ``` -------------------------------- ### Configure Amazon S3 Storage Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Configuration.md Use this configuration to set Amazon S3 as the storage engine for Cronicle. It's recommended to set `fileExtensions` to `true` for new installs. ```json { "Storage": { "transactions": true, "trans_auto_recover": true, "engine": "S3", "AWS": { "region": "us-west-1", "credentials": { "accessKeyId": "YOUR_AMAZON_ACCESS_KEY", "secretAccessKey": "YOUR_AMAZON_SECRET_KEY" } }, "S3": { "connectTimeout": 5000, "socketTimeout": 5000, "maxAttempts": 50, "keyPrefix": "", "fileExtensions": true, "params": { "Bucket": "YOUR_S3_BUCKET_ID" }, "cache": { "enabled": true, "maxItems": 1000, "maxBytes": 10485760 } } } } ``` -------------------------------- ### Get Global Server List from Cronicle Storage Source: https://github.com/jhuckaby/cronicle/wiki/Troubleshooting Retrieve the JSON document listing all servers known to Cronicle. This is useful for identifying and correcting server hostname discrepancies. ```bash /opt/cronicle/bin/storage-cli.js get global/servers/0 ``` -------------------------------- ### Plugin Job Success Output JSON Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Plugins.md A plugin must report job completion by writing a JSON object to STDOUT. This example shows the minimal JSON for a successful job, with 'complete' set to 1 and 'code' set to 0. ```json { "complete": 1, "code": 0 } ``` -------------------------------- ### Start Cronicle in Debug Mode Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Development.md Launches the Cronicle service without forking a daemon process, echoing all debug log contents to the console. Useful for debugging server-side issues. Beware of file permissions if running as a non-root user. Hit Ctrl-C to shut down. ```bash ./bin/debug.sh ``` -------------------------------- ### Configure Web Server Settings Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Configuration.md Set the HTTP and HTTPS ports, and configure SSL certificate paths for secure connections. Changing the http_port is common for direct access. ```json { "WebServer": { "http_port": 3012, "https": 0, "https_port": 3013, "https_cert_file": "conf/ssl.crt", "https_key_file": "conf/ssl.key" } } ``` -------------------------------- ### Storage Migration Command-Line Arguments Source: https://github.com/jhuckaby/cronicle/blob/master/docs/CommandLine.md Use these arguments to control the migration process. It is recommended to use '--dryrun' first for testing. ```bash /opt/cronicle/bin/control.sh migrate --debug ``` ```bash /opt/cronicle/bin/control.sh migrate --verbose ``` ```bash /opt/cronicle/bin/control.sh migrate --dryrun ``` -------------------------------- ### Recommended .gitignore File Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Development.md A sample .gitignore file to exclude development artifacts, dependencies, and generated files from version control. ```gitignore .gitignore /node_modules /work /logs /queue /data /conf htdocs/index.html htdocs/js/common htdocs/js/external/* htdocs/fonts/* htdocs/css/base.css htdocs/css/c3* htdocs/css/font* htdocs/css/mat* ``` -------------------------------- ### Get Job Status Request Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md Use this JSON payload to request the status of a specific job by its ID. This can be sent via HTTP GET query string or HTTP POST JSON data. ```json { "id": "jiinxhh5203" } ``` -------------------------------- ### Configure Scheduler Startup Grace Period Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Configuration.md Sets the delay in seconds before the scheduler assigns jobs on startup, allowing servers to register. Default is 10 seconds. ```json "scheduler_startup_grace": 10 ``` -------------------------------- ### Get Job Status Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md Fetches the status of a job, whether it is currently in progress or has already completed. This endpoint accepts both HTTP GET (using query parameters) and HTTP POST (using JSON data) requests. ```APIDOC ## GET /api/app/get_job_status/v1 ### Description Fetches the status for a job currently in progress, or one already completed. ### Method GET or POST ### Endpoint /api/app/get_job_status/v1 ### Parameters #### Query Parameters (for GET requests) - **id** (string) - Required - The ID of the job you wish to fetch status on. #### Request Body (for POST requests) - **id** (string) - Required - The ID of the job you wish to fetch status on. ### Request Example (POST) ```json { "id": "jiinxhh5203" } ``` ### Response #### Success Response (200) - **code** (integer) - Standard response code, 0 for success. - **job** (object) - Contains detailed job information. - **params** (object) - Parameters used when the job was run. - **timeout** (integer) - Job timeout in seconds. - **catch_up** (integer) - Indicates if the job is a catch-up job. - **plugin** (string) - The plugin used by the job. - **category** (string) - The ID of the job's category. - **retries** (integer) - Number of retries configured for the job. - **detached** (integer) - Indicates if the job runs in detached mode. - **notify_success** (string) - Email address to notify on success. - **notify_fail** (string) - Email address to notify on failure. - **web_hook** (string) - URL for webhook notifications. - **notes** (string) - User-provided notes for the job. - **multiplex** (integer) - Indicates if multiplexing is enabled. - **memory_limit** (integer) - Memory limit for the job in bytes. - **memory_sustain** (integer) - Sustained memory limit in bytes. - **cpu_limit** (integer) - CPU limit for the job. - **cpu_sustain** (integer) - Sustained CPU limit. - **log_max_size** (integer) - Maximum log file size. - **retry_delay** (integer) - Delay between retries in seconds. - **timezone** (string) - Timezone for the job. - **source** (string) - Origin of the job execution (e.g., Manual). - **id** (string) - The unique ID of the job. - **time_start** (number) - Unix Epoch timestamp of when the job started. - **hostname** (string) - The hostname of the server running the job. - **command** (string) - The command executed by the job. - **event** (string) - The ID of the event that triggered the job. - **now** (integer) - Current Unix Epoch timestamp. - **event_title** (string) - Title of the event. - **plugin_title** (string) - Title of the plugin. - **category_title** (string) - Title of the job's category. - **nice_target** (string) - Target for nice value adjustment. - **log_file** (string) - Local filesystem path to the job's log file. - **pid** (integer) - The main PID of the job process. - **progress** (number) - Current progress of the job (0.0 to 1.0). - **cpu** (object) - CPU usage statistics. - **min** (integer) - Minimum CPU usage. - **max** (integer) - Maximum CPU usage. - **total** (integer) - Total CPU usage. - **count** (integer) - Number of CPU measurements. - **current** (integer) - Current CPU usage. - **mem** (object) - Memory usage statistics. - **min** (integer) - Minimum memory usage in bytes. - **max** (integer) - Maximum memory usage in bytes. - **total** (integer) - Total memory usage in bytes. - **count** (integer) - Number of memory measurements. - **current** (integer) - Current memory usage in bytes. - **complete** (integer) - Set to 1 if the job is complete. - **code** (integer) - Job success code (0 for success, other values for failure). - **description** (string) - Error message if the job failed. - **perf** (string) - Performance metrics for the job. - **log_file_size** (integer) - Size of the job's log file. - **time_end** (number) - Unix Epoch timestamp of when the job completed. - **elapsed** (number) - Elapsed time of the job in seconds. #### Response Example ```json { "code": 0, "job": { "params": { "db_host": "idb01.mycompany.com", "verbose": 1, "cust": "Marketing" }, "timeout": 3600, "catch_up": 1, "plugin": "test", "category": "43f8c57e", "retries": 0, "detached": 0, "notify_success": "jhuckaby@test.com", "notify_fail": "jhuckaby@test.com", "web_hook": "http://myserver.com/notify-chronos.php", "notes": "Joe testing.", "multiplex": 0, "memory_limit": 0, "memory_sustain": 0, "cpu_limit": 0, "cpu_sustain": 0, "log_max_size": 0, "retry_delay": 30, "timezone": "America/New_York", "source": "Manual (admin)", "id": "jiiqjexr701", "time_start": 1451341765.987, "hostname": "joeretina.local", "command": "bin/test-plugin.js", "event": "3c182051", "now": 1451341765, "event_title": "Test Event 2", "plugin_title": "Test Plugin", "category_title": "Test Cat", "nice_target": "joeretina.local", "log_file": "/opt/cronicle/logs/jobs/jiiqjexr701.log", "pid": 11743, "progress": 1, "cpu": { "min": 19, "max": 19, "total": 19, "count": 1, "current": 19 }, "mem": { "min": 214564864, "max": 214564864, "total": 214564864, "count": 1, "current": 214564864 }, "complete": 1, "code": 0, "description": "Success!", "perf": "scale=1&total=90.319&db_query=3.065&db_connect=5.096&log_read=7.425&gzip_data=11.094&http_post=17.72", "log_file_size": 25110, "time_end": 1451341856.61, "elapsed": 90.62299990653992 } } ``` ``` -------------------------------- ### Enable Cronicle Auto-Start Source: https://github.com/jhuckaby/cronicle/blob/master/docs/CommandLine.md Use this command to re-enable Cronicle's automatic startup on server boot. Navigate to the Cronicle directory before running. ```sh cd /opt/cronicle npm run boot ``` -------------------------------- ### Configure Filesystem Storage Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Configuration.md Set the storage engine to 'Filesystem' for local disk storage. Specify the base directory and key namespaces for data storage. ```json { "Storage": { "transactions": true, "trans_auto_recover": true, "engine": "Filesystem", "Filesystem": { "base_dir": "data", "key_namespaces": 1 } } } ``` -------------------------------- ### Shell Plugin - Progress Reporting Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Plugins.md Demonstrates how to report intermediate progress in a shell plugin by echoing a percentage value (e.g., '50%') to standard output. ```bash #!/bin/bash # Perform some long-running task... /usr/local/bin/my-task-1.bin || exit 1 echo "25%" # And another... /usr/local/bin/my-task-2.bin || exit 1 echo "50%" # And another... /usr/local/bin/my-task-3.bin || exit 1 echo "75%" # And the final task... /usr/local/bin/my-task-4.bin || exit 1 ``` -------------------------------- ### get_schedule Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md Fetches scheduled events with support for pagination. Can be called via HTTP GET or POST. ```APIDOC ## GET /api/app/get_schedule/v1 ### Description This fetches scheduled events and returns details about them. It supports pagination to fetch chunks, with the default being the first 50 events. ### Method GET, POST ### Endpoint /api/app/get_schedule/v1 ### Parameters #### Query Parameters (for GET) - **offset** (integer) - Optional - The offset into the data to start returning records, defaults to 0. - **limit** (integer) - Optional - The number of records to return, defaults to 50. #### Request Body (for POST) - **offset** (integer) - Optional - The offset into the data to start returning records, defaults to 0. - **limit** (integer) - Optional - The number of records to return, defaults to 50. ### Request Example (POST) ```json { "offset": 0, "limit": 1000 } ``` ### Response #### Success Response (200) - **code** (integer) - Standard response code, 0 for success. - **rows** (array) - An array of event objects. - **list** (object) - Internal metadata about the list structure. - **list.length** (integer) - Total number of events in the schedule. #### Response Example ```json { "code": 0, "rows": [ { "enabled": 1, "params": { "script": "#!/bin/sh\n\n/usr/local/bin/db-reindex.pl\n" }, "timing": { "minutes": [ 10 ] }, "max_children": 1, "timeout": 3600, "catch_up": false, "plugin": "shellplug", "title": "Rebuild Indexes", "category": "general", "target": "c33ff006", "multiplex": 0, "retries": 0, "detached": 0, "notify_success": "", "notify_fail": "", "web_hook": "", "notes": "", "id": "29bf12db", "modified": 1445233242, "created": 1445233022, "username": "admin", "timezone": "America/Los_Angeles" } ], "list": { "page_size": 50, "first_page": 0, "last_page": 0, "length": 12, "type": "list" } } ``` ``` -------------------------------- ### Recover Admin Access Source: https://github.com/jhuckaby/cronicle/blob/master/docs/CommandLine.md Create a temporary administrator account from the command line to regain access to the system. Replace USERNAME and PASSWORD with your desired credentials. ```bash /opt/cronicle/bin/control.sh admin USERNAME PASSWORD ``` -------------------------------- ### Execute Storage Migration Source: https://github.com/jhuckaby/cronicle/blob/master/docs/CommandLine.md Run the migration script on the primary server after shutting down Cronicle. Ensure you have configured both 'Storage' and 'NewStorage' in your config.json. ```bash /opt/cronicle/bin/control.sh migrate ``` -------------------------------- ### Get Master Scheduler State Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md Fetches the current state of the master scheduler, indicating whether it is enabled or disabled. ```json { "code": 0, "state": { "enabled": 1 } } ``` -------------------------------- ### get_event Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md Fetches details for a single event using its ID or exact title. Supports HTTP GET or POST. ```APIDOC ## GET /api/app/get_event/v1 ### Description This fetches details about a single event, given its ID or exact title. Both HTTP GET (query string) or HTTP POST (JSON data) are acceptable. ### Method GET, POST ### Endpoint /api/app/get_event/v1 ### Parameters #### Query Parameters (for GET) - **id** (string) - The ID of the event you wish to fetch details on. - **title** (string) - The exact title of the event you wish to fetch details on (case-sensitive). #### Request Body (for POST) - **id** (string) - The ID of the event you wish to fetch details on. - **title** (string) - The exact title of the event you wish to fetch details on (case-sensitive). ### Request Example (POST) ```json { "id": "540cf457" } ``` ### Response #### Success Response (200) - **code** (integer) - Standard response code, 0 for success. - **event** (object) - The details for the requested event. #### Response Example ```json { "code": 0, "event": { "enabled": 0, "params": { "script": "#!/bin/sh\n\n/usr/local/bin/s3-backup-logs.pl\n" }, "timing": { "minutes": [ 5 ] }, "max_children": 1, "timeout": 3600, "catch_up": false, "plugin": "shellplug", "title": "Backup Logs to S3", "category": "ad8190ff", "target": "all", "multiplex": 0, "retries": 0, "detached": 0, "notify_success": "", "notify_fail": "", "web_hook": "", "notes": "", "id": "540cf457", "modified": 1449941100, "created": 1445232960, "username": "admin", "retry_delay": 0, "cpu_limit": 0, "cpu_sustain": 0, "memory_limit": 0, "memory_sustain": 0, "log_max_size": 0, "timezone": "America/Los_Angeles" } } ``` ``` -------------------------------- ### Standard Error API Response Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md An example of a JSON response when an API error occurs. Includes 'code' and 'description' properties. ```json {"code": "session", "description": "No Session ID or API Key could be found"} ``` -------------------------------- ### Configure User Account Settings Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Configuration.md Control whether guest users can create accounts and define the default privileges for new user accounts. This impacts user management and access control. ```json { "User": { "free_accounts": 0, "default_privileges": { "admin": 0, "create_events": 1, "edit_events": 1, "delete_events": 1, "run_events": 0, "abort_events": 0, "state_update": 0 } } } ``` -------------------------------- ### Configure Couchbase Storage Source: https://github.com/jhuckaby/cronicle/blob/master/docs/Configuration.md Use this configuration to set Couchbase as the storage engine for Cronicle. Ensure you install Couchbase Client v2.6.12. ```json { "Storage": { "transactions": true, "trans_auto_recover": true, "engine": "Couchbase", "Couchbase": { "connectString": "couchbase://127.0.0.1", "bucket": "default", "username": "", "password": "", "serialize": false, "keyPrefix": "cronicle" } } } ``` -------------------------------- ### Cronicle Log Entry Format Source: https://github.com/jhuckaby/cronicle/blob/master/docs/InnerWorkings.md Example of a typical log entry written by Cronicle. The format is configurable via the 'log_columns' setting. ```text [1450993152.554][2015/12/24 13:39:12][joeretina.local][Cronicle][debug][3][Cronicle starting up][] ``` ```text [1450993152.565][2015/12/24 13:39:12][joeretina.local][Cronicle][debug][4][Server is eligible to become primary (Main Group)][] ``` ```text [1450993152.566][2015/12/24 13:39:12][joeretina.local][Cronicle][debug][3][We are becoming the primary server][] ``` ```text [1450993152.576][2015/12/24 13:39:12][joeretina.local][Cronicle][debug][2][Startup complete, entering main loop][] ``` -------------------------------- ### Disable Cronicle Auto-Start Source: https://github.com/jhuckaby/cronicle/blob/master/docs/CommandLine.md Use this command to prevent Cronicle from automatically starting on server boot. Navigate to the Cronicle directory before running. ```sh cd /opt/cronicle npm run unboot ``` -------------------------------- ### Configure Single Log File Source: https://github.com/jhuckaby/cronicle/blob/master/docs/InnerWorkings.md Logs all events to a single file named 'event.log' by setting 'log_filename' to a static string instead of a pattern. ```json { "log_filename": "event.log" } ``` -------------------------------- ### Get All Active Jobs Status Source: https://github.com/jhuckaby/cronicle/blob/master/docs/APIReference.md Fetches the status for all currently active jobs. This endpoint returns a comprehensive list of active jobs and their details. ```json { "code": 0, "jobs": { "jk6lmar4c01": { ... }, "jk6lmar4d04": { ... } } } ```