Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 3.28 KB

schedule.md

File metadata and controls

16 lines (13 loc) · 3.28 KB

Its own schedule

It promises to come back, and it does. A timed wake (pots wake) wakes it once, at a time it chooses. A routine (pots routine) repeats: every 30 minutes, say, or on a cron schedule in the computer's time zone. Both live in the same database as everything else, so they survive restarts. It can also add normal cron jobs on its machine.

Command What it does
pots routine add <name> (--every <duration> | --cron "<expr>") (--note "<text>" | --run "<command>" | --child "<brief>") [--timeout <duration>] Add a routine, or replace the one with that name. Names are letters, digits, - and _; durations are as in pots wake --in: 90s, 30m, 2h, 1d
pots routine list Each routine's schedule, what it does, its next time and its last run
pots routine remove <name> Remove a routine
  • --note wakes the bot with the note at each time. --run makes Pots run the command at each time, in the bot's shell, folder and environment, with POTS_FROM set to the routine's name. The command decides itself whether to wake the bot with pots wake, so watching an inbox every few minutes costs no model request until there is mail. --child starts a child at each time with the text as its brief, without waking the bot; the child decides itself whether to wake it, so a check that finds nothing leaves nothing in the bot's conversation.
  • A run is skipped while the last run of the same routine still runs, or the child it started still works. Times missed while the gateway was stopped or the computer was off or asleep are skipped, not made up: the next run is the next time from now.
  • A command runs at most 10 minutes, or its --timeout; then Pots stops it and the processes it started. When the gateway stops, it stops the commands it runs.
  • Pots keeps each run's start, end, exit code and last lines of output for 7 days. A failed run (a non-zero exit code, the timeout, or a child that could not start, such as at settings.maxChildren) wakes the bot once, with that output; later failures of the same routine do not, until one of its runs succeeds.
  • A script that calls pots wake says where the wake comes from with --from <name> (letters, digits, - and _), or $POTS_FROM. The wake then tells the bot that it comes from a command on this computer, not from a person, so outside text in its note, such as an email's subject, does not read as the bot's own plan. With --id <id>, a second pots wake with the same ID gives back the first wake and sets none, as pots send --id does.
  • The look. At its first start, Pots gives each bot one routine, look: at 8:00, 11:00, 14:00, 17:00 and 20:00 in the computer's time zone (--cron "0 8-22/3 * * *"), it starts a child that looks, unasked, for what the bot's people would want to know or have done, with what the bot has: its memory, the message log, its tools and the logins on its computer. It sees what was said before and how people took it. When it finds something worth their attention, it wakes the bot with it and where it found it; otherwise it ends quietly and nothing goes into the bot's conversation. The bot decides whether and when to tell people. Ask the bot for other times, or for none, and it changes or removes the routine; Pots never adds it again, also after an upgrade or a restart.