{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"never","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"Schedule your backups","type":"basic","slug":"schedule-your-backups","excerpt":"Ensure backups are done in a consistent and timely manner","body":"You may use any scheduler to launch ElectricSheep.IO runs, such as Cron or Chronos. However, we think that the scheduling options for your backups should be:\n\n* simple to read and configure: there's a 99% chance you'll want your backups to execute hourly or daily at a specific time\n* come along your backup jobs: not in a crontab lost somewhere on your filesystem\n\nElectricSheep.IO thus provides you with an easy, built-in and human-readable way of scheduling your backups. To do so, specify a schedule for each of your job directly in your _Sheepfile_:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"job \\\"my-backup\\\" do\\n  schedule \\\"daily\\\"\\n  ...\\nend\",\n      \"language\": \"ruby\",\n      \"name\": \"Sheepfile\"\n    }\n  ]\n}\n[/block]\nThen start the program as a daemon:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"electric_sheep start -d\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThat's it! Your backup project will execute every day at midnight, starting tonight.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Scheduling options\"\n}\n[/block]\n### Hourly\n\nTo run your job every hour:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"job \\\"my-backup\\\" do\\n  schedule \\\"hourly\\\"\\n  ...\\nend\",\n      \"language\": \"ruby\",\n      \"name\": \"Sheepfile\"\n    }\n  ]\n}\n[/block]\nIf you want your backup to start past a specific minute, use the `past` option (defaults to `0`):\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"job \\\"my-backup\\\" do\\n  schedule \\\"hourly\\\", past: 10\\n  ...\\nend\",\n      \"language\": \"ruby\",\n      \"name\": \"Sheepfile\"\n    }\n  ]\n}\n[/block]\n### Daily\n\nTo run your job every day at midnight:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"job \\\"my-backup\\\" do\\n  schedule \\\"daily\\\"\\n  ...\\nend\",\n      \"language\": \"ruby\",\n      \"name\": \"Sheepfile\"\n    }\n  ]\n}\n[/block]\nIf you want your backup to start at a specific time:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"job \\\"my-backup\\\" do\\n  schedule \\\"daily\\\", at: \\\"03:17\\\"\\n  ...\\nend\",\n      \"language\": \"ruby\",\n      \"name\": \"Sheepfile\"\n    }\n  ]\n}\n[/block]\n### Weekly\n\nTo run your job every monday at midnight:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"job \\\"my-backup\\\" do\\n  schedule \\\"weekly\\\", on: \\\"monday\\\"\\n  ...\\nend\",\n      \"language\": \"ruby\",\n      \"name\": \"Sheepfile\"\n    }\n  ]\n}\n[/block]\nIf you want your backup to start at a specific time:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"job \\\"my-backup\\\" do\\n  schedule \\\"weekly\\\", on: \\\"monday\\\", at: \\\"04:00\\\"\\n  ...\\nend\",\n      \"language\": \"ruby\",\n      \"name\": \"Sheepfile\"\n    }\n  ]\n}\n[/block]\n### Monthly\n\nTo run your prjoboject every fifteenth of a month:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"job \\\"my-backup\\\" do\\n  schedule \\\"monthly\\\", every: 15\\n  ...\\nend\",\n      \"language\": \"ruby\",\n      \"name\": \"Sheepfile\"\n    }\n  ]\n}\n[/block]\nIf you want your backup to start at a specific time:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"job \\\"my-backup\\\" do\\n  schedule \\\"monthly\\\", every: 15, at: \\\"04:00\\\"\\n  ...\\nend\",\n      \"language\": \"ruby\",\n      \"name\": \"Sheepfile\"\n    }\n  ]\n}\n[/block]\n### Cron\n\nTo setup a complex schedule, you may use Cron expressions:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"job \\\"my-backup\\\" do\\n  schedule \\\"cron\\\", expression: \\\"* 1 * * *\\\"\\n  ...\\nend\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Multiple schedules\"\n}\n[/block]\nYou may need to schedule a backup job multiple times, for example every 6 hours. To do so, simply use the `schedule` verb multiple times:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"job \\\"my-backup\\\" do\\n  schedule \\\"daily\\\", at: \\\"00:00\\\"\\n  schedule \\\"daily\\\", at: \\\"06:00\\\"\\n  schedule \\\"daily\\\", at: \\\"12:00\\\"\\n  schedule \\\"daily\\\", at: \\\"18:00\\\"\\n  ...\\nend\",\n      \"language\": \"ruby\",\n      \"name\": \"Sheepfile\"\n    }\n  ]\n}\n[/block]","updates":[],"order":1,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"54fda39021538c21006c49b8","category":{"sync":{"isSync":false,"url":""},"pages":["54fda39021538c21006c49b6","54fda39021538c21006c49b7","54fda39021538c21006c49b8","54fda39021538c21006c49b9","54fda39021538c21006c49ba","54fda39021538c21006c49bb","54fda5d10c05ea25004ce0cd","5582f41f81672a3900bb4fe9"],"title":"Documentation","slug":"documentation","order":0,"from_sync":false,"reference":false,"_id":"54fda38f21538c21006c49a7","createdAt":"2014-11-08T14:11:40.826Z","project":"545e249c7ca5470800b3a1b2","version":"54fda38e21538c21006c49a6","__v":3},"user":"545e246f7ca5470800b3a1b1","createdAt":"2014-11-29T16:00:19.890Z","version":{"version":"0.5.0","version_clean":"0.5.0","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["54fda38f21538c21006c49a7","54fda38f21538c21006c49a8","54fda38f21538c21006c49a9","54fda38f21538c21006c49aa","54fda38f21538c21006c49ab","54fda3d347f93619001d2ae2","54fea8975c4ab10d00ef4279"],"_id":"54fda38e21538c21006c49a6","__v":3,"createdAt":"2015-03-09T13:43:42.927Z","forked_from":"54eb4535615ffc19003059f0","project":"545e249c7ca5470800b3a1b2","releaseDate":"2015-03-09T13:43:42.927Z"},"__v":2,"githubsync":"","project":"545e249c7ca5470800b3a1b2"}

Schedule your backups

Ensure backups are done in a consistent and timely manner

You may use any scheduler to launch ElectricSheep.IO runs, such as Cron or Chronos. However, we think that the scheduling options for your backups should be: * simple to read and configure: there's a 99% chance you'll want your backups to execute hourly or daily at a specific time * come along your backup jobs: not in a crontab lost somewhere on your filesystem ElectricSheep.IO thus provides you with an easy, built-in and human-readable way of scheduling your backups. To do so, specify a schedule for each of your job directly in your _Sheepfile_: [block:code] { "codes": [ { "code": "job \"my-backup\" do\n schedule \"daily\"\n ...\nend", "language": "ruby", "name": "Sheepfile" } ] } [/block] Then start the program as a daemon: [block:code] { "codes": [ { "code": "electric_sheep start -d", "language": "shell" } ] } [/block] That's it! Your backup project will execute every day at midnight, starting tonight. [block:api-header] { "type": "basic", "title": "Scheduling options" } [/block] ### Hourly To run your job every hour: [block:code] { "codes": [ { "code": "job \"my-backup\" do\n schedule \"hourly\"\n ...\nend", "language": "ruby", "name": "Sheepfile" } ] } [/block] If you want your backup to start past a specific minute, use the `past` option (defaults to `0`): [block:code] { "codes": [ { "code": "job \"my-backup\" do\n schedule \"hourly\", past: 10\n ...\nend", "language": "ruby", "name": "Sheepfile" } ] } [/block] ### Daily To run your job every day at midnight: [block:code] { "codes": [ { "code": "job \"my-backup\" do\n schedule \"daily\"\n ...\nend", "language": "ruby", "name": "Sheepfile" } ] } [/block] If you want your backup to start at a specific time: [block:code] { "codes": [ { "code": "job \"my-backup\" do\n schedule \"daily\", at: \"03:17\"\n ...\nend", "language": "ruby", "name": "Sheepfile" } ] } [/block] ### Weekly To run your job every monday at midnight: [block:code] { "codes": [ { "code": "job \"my-backup\" do\n schedule \"weekly\", on: \"monday\"\n ...\nend", "language": "ruby", "name": "Sheepfile" } ] } [/block] If you want your backup to start at a specific time: [block:code] { "codes": [ { "code": "job \"my-backup\" do\n schedule \"weekly\", on: \"monday\", at: \"04:00\"\n ...\nend", "language": "ruby", "name": "Sheepfile" } ] } [/block] ### Monthly To run your prjoboject every fifteenth of a month: [block:code] { "codes": [ { "code": "job \"my-backup\" do\n schedule \"monthly\", every: 15\n ...\nend", "language": "ruby", "name": "Sheepfile" } ] } [/block] If you want your backup to start at a specific time: [block:code] { "codes": [ { "code": "job \"my-backup\" do\n schedule \"monthly\", every: 15, at: \"04:00\"\n ...\nend", "language": "ruby", "name": "Sheepfile" } ] } [/block] ### Cron To setup a complex schedule, you may use Cron expressions: [block:code] { "codes": [ { "code": "job \"my-backup\" do\n schedule \"cron\", expression: \"* 1 * * *\"\n ...\nend", "language": "ruby" } ] } [/block] [block:api-header] { "type": "basic", "title": "Multiple schedules" } [/block] You may need to schedule a backup job multiple times, for example every 6 hours. To do so, simply use the `schedule` verb multiple times: [block:code] { "codes": [ { "code": "job \"my-backup\" do\n schedule \"daily\", at: \"00:00\"\n schedule \"daily\", at: \"06:00\"\n schedule \"daily\", at: \"12:00\"\n schedule \"daily\", at: \"18:00\"\n ...\nend", "language": "ruby", "name": "Sheepfile" } ] } [/block]