Run
Services and Schedules
Start and stop system services, run jobs on a schedule, and keep your commands.
Services are systemd services. Schedules are systemd timers that Bistro writes for you. Both live in the sidebar.
#Services Page
The page lists every service with its state. Each row can start, stop or restart a service, start it at boot or not, show its log and show details.
bistro services # running and failed services
bistro services list all
bistro services status nginx
bistro services restart nginx
bistro services disable nginx # do not start at boot#Schedule a Command
To schedule a command, open the Schedules page. It lists your Bistro jobs and every systemd timer on the machine. Add a job with a name, a time and a command. Templates cover backup, upgrade, clean junk, restart and snapshot.
bistro sched add nightly 'every day at 3am' -- bistro clean
bistro sched # list jobs
bistro sched run nightly
bistro sched history nightly # the last 20 runs
bistro sched disable nightly
bistro sched remove nightlyA time can be plain words, a cron line or a systemd calendar expression. Check it first:
bistro sched check 'every sunday at 3am' # shows the next 3 run times| Time | Meaning |
|---|---|
daily | Once a day |
every sunday at 3am | Weekly |
*/5 * * * * | Cron, every 5 minutes |
in 2 hours | Once, then the job removes itself |
on boot | About 2 minutes after each start |
#Job Options
Add these to bistro sched add before the --.
| Option | Effect |
|---|---|
--retries N | Run again after a failure, up to 5 times. |
--retry-wait S | Seconds between tries. |
--timeout S | Stop the job after S seconds. |
--notify fail, always, never | When to alert you. The default is fail. |
--jitter S | Start after a random delay. |
--ping URL | Dead man's switch, like Healthchecks. |
--then JOB | Start another job when this one succeeds. |
--once | Run once, then remove the job. |
--node N | Run on a cluster member. See cluster. |
#Import from Cron
crontab -l | bistro sched import # turn cron lines into Bistro jobsBistro lists what it would make and asks first. It skips lines it cannot read.
#Pause Everything
Pause All Jobs stops every timer, for example before maintenance. Resume starts them again.
bistro sched pause on
bistro sched pause off#All Timers in One Place
Bistro also shows systemd timers, /etc/crontab, /etc/cron.d and user crontabs together.
bistro timers # name, source, next run, last run
bistro calendar 14 # what runs in the next 14 days#Autopilot
Autopilot lets Bistro fix problems itself, within limits. It has a daily limit per fix, a pause switch and a maintenance window.
bistro auto # mode and fixes made today
bistro auto pause 24 # stop self-healing for 24 hours
bistro auto resume#Saved Commands and Runbook
Snippets are saved commands that every admin and the dashboard share.
echo 'systemctl restart nginx' | bistro snippet save restart-web
bistro snippet
bistro snippet show restart-webThe runbook is one Markdown page. It says what the server is and how to bring each part back. A weekly timer rewrites it. It holds no secrets. Print it and keep a copy off the box.
bistro runbook