From 1b591284a9021d0a9fb6933436a49ba0af3c7bb0 Mon Sep 17 00:00:00 2001 From: waldek Date: Tue, 24 Aug 2021 01:30:47 +0200 Subject: [PATCH] adds tmp --- modules/qualifying/tmp.md | 54 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 modules/qualifying/tmp.md diff --git a/modules/qualifying/tmp.md b/modules/qualifying/tmp.md new file mode 100644 index 0000000..ce1b452 --- /dev/null +++ b/modules/qualifying/tmp.md @@ -0,0 +1,54 @@ +# Solution + +## First alternative solution + +### The udev rule + +``` +➜ ~ git:(master) ✗ cat /etc/udev/rules.d/99-backup_to_usb_stick.rules +SUBSYSTEM=="block", ENV{ID_FS_UUID}=="2469ffe5-e066-476d-805a-cde85a58ea3b", ACTION=="add", TAG+="systemd", SYMLINK+="backup_partition" +➜ ~ git:(master) ✗ +``` + +### The device file + +``` +➜ ~ git:(master) ✗ cat /etc/systemd/system/dev-backup_partition.device +[Unit] +Description=my device +Wants=tester.service +➜ ~ git:(master) ✗ +``` + +### The service file + +``` +➜ ~ git:(master) ✗ cat /etc/systemd/system/tester.service +[Unit] +Description=A tester +Requires=dev-backup_partition.device +After=dev-backup_partition.device + +[Service] +ExecStart=echo "test" + +[Install] +WantedBy=default.target +➜ ~ git:(master) ✗ +``` + +## Second alternative solution + +Can be done via mount files as well. + +### The udev rule + +``` +➜ ~ git:(master) ✗ cat /etc/udev/rules.d/99-backup_to_usb_stick.rules +SUBSYSTEM=="block", ENV{ID_FS_UUID}=="2469ffe5-e066-476d-805a-cde85a58ea3b", ACTION=="add", TAG+="systemd", SYMLINK+="backup_partition", RUN{program}+="/usr/bin/systemd-mount --no-block --automount=yes --collect $devnode /media/backup_stick" +➜ ~ git:(master) ✗ +``` + +### The mount file + +### The service file