ssh_backup_schedule
Schedule automated backups for databases and files on SSH servers using cron. Configure retention periods and specify backup types including MySQL, PostgreSQL, MongoDB, and file systems.
Instructions
Schedule automatic backups using cron
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| server | Yes | Server name | |
| schedule | Yes | Cron schedule (e.g., "0 2 * * *" for daily at 2 AM) | |
| type | Yes | Backup type | |
| name | Yes | Backup name | |
| database | No | Database name (for db types) | |
| paths | No | Paths to backup (for files type) | |
| retention | No | Retention period in days (default: 7) |
Implementation Reference
- src/tool-registry.js:40-46 (registration)Registration of 'ssh_backup_schedule' tool in the backup group of TOOL_GROUPS// Backup group (4 tools) - Backup and restore operations backup: [ 'ssh_backup_create', 'ssh_backup_list', 'ssh_backup_restore', 'ssh_backup_schedule' ],
- src/backup-manager.js:435-441 (helper)Core helper function to build the shell command for scheduling a backup job using crontab on the remote server* Build cron schedule command */ export function buildCronScheduleCommand(schedule, backupCommand, cronComment) { // Add cron job with comment const cronLine = `${schedule} ${backupCommand} # ${cronComment}`; return `(crontab -l 2>/dev/null; echo '${cronLine}') | crontab -`; }
- src/backup-manager.js:443-470 (helper)Helper function to parse the output of crontab -l and extract scheduled backup jobs/** * Parse cron list output */ export function parseCronJobs(output) { if (!output || !output.trim()) { return []; } const jobs = []; const lines = output.split('\n'); for (const line of lines) { if (line.trim() && !line.startsWith('#') && line.includes('ssh-manager-backup')) { const parts = line.split('#'); const schedule = parts[0].trim(); const comment = parts[1] ? parts[1].trim() : ''; jobs.push({ schedule, comment, command: schedule.split(/\s+/).slice(5).join(' ') }); } } return jobs; }