istro

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 nightly

A 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
TimeMeaning
dailyOnce a day
every sunday at 3amWeekly
*/5 * * * *Cron, every 5 minutes
in 2 hoursOnce, then the job removes itself
on bootAbout 2 minutes after each start

#Job Options

Add these to bistro sched add before the --.

OptionEffect
--retries NRun again after a failure, up to 5 times.
--retry-wait SSeconds between tries.
--timeout SStop the job after S seconds.
--notify fail, always, neverWhen to alert you. The default is fail.
--jitter SStart after a random delay.
--ping URLDead man's switch, like Healthchecks.
--then JOBStart another job when this one succeeds.
--onceRun once, then remove the job.
--node NRun on a cluster member. See cluster.

#Import from Cron

crontab -l | bistro sched import   # turn cron lines into Bistro jobs

Bistro 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-web

The 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