Article 58BS6 New to systemd and need help

New to systemd and need help

by
bellsal
from LinuxQuestions.org on (#58BS6)
Hi All,

I am new to systemd, and I am having trouble understanding it. In the past I used init, and it was easier to understand.

Here is what I am trying to do; at shutdown (-h or -r), I need to unmount a veracrypt volume by issuing the following command: veracrypt -t -d. Very simple - nothing fancy!

I created the following systemd service:

[Unit]
Description=Umount Veracrypt Volume at shutdown
Requires=network.target
DefaultDependencies=no
Before=shutdown.target reboot.target poweroff.target

[Service]
Type=oneshot
RemainAfterExit=/bin/true
ExecStart=/bin/true
ExecStop=/usr/bin/veracrypt -t -d

[Install]
WantedBy=multi-user.target

- I named this service umount_veracrypt_volume.service
- Saved this file in /usr/lib/systemd/system
- Ran the following command: systemctl daemon-reload
- Enabled the service: systemctl enable umount_veracrypt_volume.service

Question:
1. Is my service script correct?
2. Did I save it in the right location?
3. How do I test it if it works? I really don't know how to test it since the machine shuts down, but I don't know if it umounted the veracrypt volume prior to completing the shutdown.

Please help me!

Sallatest?d=yIl2AUoC8zA latest?i=x5C9Y1f8_Go:qU1pesd10S8:F7zBnMy latest?i=x5C9Y1f8_Go:qU1pesd10S8:V_sGLiP latest?d=qj6IDK7rITs latest?i=x5C9Y1f8_Go:qU1pesd10S8:gIN9vFwx5C9Y1f8_Go
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments