Creating another service for trapping shutdown

General support questions
Post Reply
lightman47
Posts: 1521
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Creating another service for trapping shutdown

Post by lightman47 » 2017/12/13 18:42:37

Previously, and with help, I'd created a startup service to log a machine start to a network file (viewtopic.php?f=47&t=64565)

I am now wishing to create a similar logging service for insertion into the shutdown procedure. Of course, the network still has to be connected, and I also realize that a crash, or power-off won't run my 'service'; that is OK. My interest is running my script during normal,software requested shutdowns.

My question then becomes about which 'After,WantedBy', etc. I need to accomplish this. My STARTUP service with it's script name:

Code: Select all

[Unit]
Description=MachineStartupLogging
After=network-online.target

[Service]
Type=simple
WorkingDirectory=/scripts
ExecStart=/bin/bash /scripts/machineStartStamp.sh
User=root
Group=root

[Install]
WantedBy=multi-user.target

I have been reading (and getting lost in ): https://access.redhat.com/documentation ... d-services

Thank you.

Post Reply