[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Bug] Systemd Shutdown



在 2017年8月1日星期二 CST 下午4:14:46,David Yoon 写道:
> Hello,
> 
> Before I start, I really like Debian 8.
> 
> I'm not an expert in Linux, but I think I found an issue.
> I'm using Debian 8.7 and running in root.
> I wanted to use systemd to copy meta-data file from ramdisk before I
> shutdown.
> Here's the steps that I did:
> 1) created a file called test.sh, which is a script stored in
> /usr/local/bin/:
> 
> #!/bin/sh
> cp -r /home/david/test/tt.log /home/david/test1/tt.log
> 
> 2) created a file test.service and stored in /etc/systemd/system/
> In test.service,
> [Unit]
> Description=The Shutdown
> 
> [Service]
> Type=oneshot
> ReaminAfterExit=true
> ExecStart=/bin/true
> ExecStop=/usr/local/bin/test.service.sh
> 
> [Install]
> WantedBy=multi-user.target
> 
> 3) I run systemctl daemon-reload and systemctl enable test.service.
> 
> 4) When I checked "systemctl status test.service", it states active.
> 
> However, when I reboot or shutdown, it doesn't work.
> There is no file found in /home/david/test1/
> 
> Please advise.
> Thanks,
> 
> David

Hello,

You have contacted the Debian website team, who are responsible for
the Debian website. The Debian website team does not offer user
support, please contact one of the Debian user support channels for
help.

https://www.debian.org/support
* https://lists.debian.org/debian-user/
http://forums.debian.net/
http://ask.debian.net/
irc://irc.oftc.net/debian

Besides, obviously you are writing an incorrect systemd unit that won't work 
as you expected from the beginning. You might want to learn more about systemd 
and its related units before such job.


Sincerely,
Boyuan Yang


Reply to: