From d2e97f40421d3f886429ab612d5de178700c40b0 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 21 Jan 2016 16:21:39 +0100 Subject: [PATCH] Add some demo units --- demo/demo-error@.service | 7 +++++++ demo/demo-limits.slice | 8 ++++++++ demo/demo-notify@.service | 6 ++++++ demo/demo-timer.service | 6 ++++++ demo/demo-timer.timer | 12 ++++++++++++ demo/notes.md | 27 +++++++++++++++++++++++++++ 6 files changed, 66 insertions(+) create mode 100644 demo/demo-error@.service create mode 100644 demo/demo-limits.slice create mode 100644 demo/demo-notify@.service create mode 100644 demo/demo-timer.service create mode 100644 demo/demo-timer.timer create mode 100644 demo/notes.md diff --git a/demo/demo-error@.service b/demo/demo-error@.service new file mode 100644 index 000000000..b2d4c9d34 --- /dev/null +++ b/demo/demo-error@.service @@ -0,0 +1,7 @@ +[Unit] +Description=Demonstrate failing units +OnFailure=demo-notify@%n.service + +[Service] +Type=oneshot +ExecStart=/usr/bin/false diff --git a/demo/demo-limits.slice b/demo/demo-limits.slice new file mode 100644 index 000000000..583db59ba --- /dev/null +++ b/demo/demo-limits.slice @@ -0,0 +1,8 @@ +[Unit] +Description=Limited resources demo +DefaultDependencies=no +Before=slices.target + +[Slice] +CPUQuota=10% +MemoryLimit=1G diff --git a/demo/demo-notify@.service b/demo/demo-notify@.service new file mode 100644 index 000000000..e25524b4e --- /dev/null +++ b/demo/demo-notify@.service @@ -0,0 +1,6 @@ +[Unit] +Description=Demonstrate systemd templating by sending a notification + +[Service] +Type=oneshot +ExecStart=/usr/bin/notify-send 'Systemd notification' '%i' diff --git a/demo/demo-timer.service b/demo/demo-timer.service new file mode 100644 index 000000000..2f6a20e14 --- /dev/null +++ b/demo/demo-timer.service @@ -0,0 +1,6 @@ +[Unit] +Description=Demo unit for systemd timers + +[Service] +Type=oneshot +ExecStart=/usr/bin/echo "Systemd timer fired! Hello Hackeriet." diff --git a/demo/demo-timer.timer b/demo/demo-timer.timer new file mode 100644 index 000000000..ab5ec5135 --- /dev/null +++ b/demo/demo-timer.timer @@ -0,0 +1,12 @@ +[Unit] +Description=Demonstrate systemd timers + +[Timer] +OnActiveSec=2 +OnUnitActiveSec=5 +AccuracySec=5 + +# OnCalendar=Thu,Fri 2016-*-1,5 11:12:13 + +[Install] +WantedBy=multi-user.target diff --git a/demo/notes.md b/demo/notes.md new file mode 100644 index 000000000..b4866b164 --- /dev/null +++ b/demo/notes.md @@ -0,0 +1,27 @@ +# simple oneshot + +Run `demo-notify@hello.service` + +# simple timer + +Run `demo-timer.timer`, show both + +# enabling + +Enable `demo-timer.timer`, go to symlink folder, disable + +# OnError + +Show & run `demo-error.service` + +# cgroups demo + +Start `demo-stress.service` without, show in htop, stop +Show slice unit, start slice unit +Add Slice=demo-limits.slice +daemon-reload +Start stress again + +# Proper service + +Look at nginx unit