Add some demo units
This commit is contained in:
parent
f368f12a90
commit
d2e97f4042
6 changed files with 66 additions and 0 deletions
7
demo/demo-error@.service
Normal file
7
demo/demo-error@.service
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Demonstrate failing units
|
||||||
|
OnFailure=demo-notify@%n.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/bin/false
|
8
demo/demo-limits.slice
Normal file
8
demo/demo-limits.slice
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Limited resources demo
|
||||||
|
DefaultDependencies=no
|
||||||
|
Before=slices.target
|
||||||
|
|
||||||
|
[Slice]
|
||||||
|
CPUQuota=10%
|
||||||
|
MemoryLimit=1G
|
6
demo/demo-notify@.service
Normal file
6
demo/demo-notify@.service
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Demonstrate systemd templating by sending a notification
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/bin/notify-send 'Systemd notification' '%i'
|
6
demo/demo-timer.service
Normal file
6
demo/demo-timer.service
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Demo unit for systemd timers
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/usr/bin/echo "Systemd timer fired! Hello Hackeriet."
|
12
demo/demo-timer.timer
Normal file
12
demo/demo-timer.timer
Normal file
|
@ -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
|
27
demo/notes.md
Normal file
27
demo/notes.md
Normal file
|
@ -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
|
Loading…
Reference in a new issue