A Centralized Remote File & CronJob Management Tool

What is it?

On the client side, it is a daemon process that:

  • Pulls cron tasks from a central server periodically
  • Works like a cron daemon, executing the tasks at the specified time
  • Reports the results back to the server (stdout, stderr, exit code, etc.)

On the server side, it is a web application that:

  • Manages all the cron tasks
  • Reviews the results reported by the client
  • Provides a web interface for managing the tasks (TODO)

Why?

  • Deploying cron tasks to multiple servers is a pain, especially when you need to update them
  • On Windows, there is no cron daemon, so you need to use a third-party tool
  • To the best of my knowledge, there is few easy and elegant way to:
    • 'Subscribe' some changeful network resources to local file system across many machines

How to use it?

Client

$ agent -c /path/to/config.json

config.json File Format:

{
    "server": "127.0.0.1:44444",    // Server address
    "agent_id": "a3855a9d-864b-4613-91b3-27d564a9ce8d", // agent id from server
    "key": "hello world",           // encryption key of the communication
    "pull": true,                   // whether to pull tasks from server
    "pull_interval": 300,           // pull interval in seconds
    "report": true,                 // whether to report results to server
    "report_interval": 60           // report interval in seconds
}

task.json persists the tasks that are pulled from the server. It is generated by the client, and should not be modified manually.

Server

$ server -c /path/to/config.json

config.json File Format:

{
    "ctl_addr": "0.0.0.0:44444",    // Bind address for control
    "api_addr": "127.0.0.1:5000",   // Bind address for Web API
    "key": "hello world"            // encryption key of the communication
}

agentdb.json persists the agents that are registered to the server. It is generated by the server, and should not be modified manually.

/path/to/logs is the directory where the logs are stored.

Server API

  • GET /agent:

  • POST /agent:

  • GET /agent/:agent_id:

  • PUT /agent/:agent_id:

  • DELETE /agent/:agent_id:

  • GET /agent/:agent_id/task:

  • POST /agent/:agent_id/task:

  • GET /agent/:agent_id/task/:task_id:

  • PUT /agent/:agent_id/task/:task_id:

  • DELETE /agent/:agent_id/task/:task_id:

Task Specification

TODO