Tmux Scheduler

Schedule agent check-ins and automated tasks

Overview

The node "Tmux Scheduler" provides functionality to manage scheduled tasks related to tmux sessions, including scheduling agent check-ins, creating reminders, managing cron jobs, listing scheduled tasks, canceling tasks, and batch scheduling multiple tasks. The Cancel Task operation specifically allows users to cancel a previously scheduled task by its ID. This is useful in scenarios where a scheduled job or reminder is no longer needed or was created by mistake.

Practical examples:

  • Canceling a scheduled agent check-in that is no longer relevant.
  • Removing a reminder set for an agent before it triggers.
  • Deleting a cron job that automates recurring commands in the tmux environment.

Properties

Name Meaning
Task ID ID of the task to cancel. This can be an at job ID, a reminder ID, or a cron job ID.

Output

The output JSON object contains the following fields:

  • success (boolean): Indicates if the cancellation was successful.
  • cancelledTaskId (string): The ID of the task that was cancelled.
  • taskType (string): The type of the cancelled task; possible values include "at job", "reminder", or "cron job".
  • message (string): A human-readable message confirming the cancellation.

No binary data is output by this operation.

Example output:

{
  "success": true,
  "cancelledTaskId": "12345",
  "taskType": "at job",
  "message": "at job cancelled successfully"
}

Dependencies

  • Requires access to system commands such as atrm to remove scheduled "at" jobs.
  • Reads and writes to a local JSON file /tmp/tmux-reminders.json to manage reminders.
  • Uses system crontab command to manage cron jobs.
  • Optionally uses credentials that may specify external script directories or project base paths, but these are not mandatory for cancelling tasks.
  • Node depends on the child_process module to execute shell commands synchronously.
  • Requires appropriate permissions to execute system commands and modify crontab.

Troubleshooting

  • Common issues:

    • Task ID not found: If the provided Task ID does not match any scheduled "at" job, reminder, or cron job, the node will throw an error indicating the task was not found.
    • Permission errors: The node executes system commands like atrm and crontab. Insufficient permissions may cause failures.
    • File access errors: The reminders are stored in /tmp/tmux-reminders.json. If this file is missing or corrupted, reminder cancellation might fail.
  • Error messages and resolutions:

    • Failed to cancel task: Task <ID> not found: Verify the Task ID is correct and corresponds to an existing scheduled task.
    • Errors related to executing atrm or crontab: Ensure the n8n process has sufficient OS-level permissions to run these commands.
    • JSON parsing errors on /tmp/tmux-reminders.json: Check the integrity of the reminders file or delete it to reset reminders.

Links and References

Discussion