05-09-2014
Systemd
Hallo
I don't know where to put my question so I put it here.
I want that systemd let run a script but only on shutdown or reboot
and before the system umount the mounted devices.
I look on google but only a little information is found and not working
Until no, I don't find an solution for my problem.
Here under is my service
---------------------------------------------------------
[Unit]
Description=exit_manjaro
Before=shutdown.target
[Service]
Type=oneshot
ExecStart=usr/local/bin/exit_manjaro.sh
[Install]
WantedBy=multi-user.target
--------------------------------------------------------
when I do "sudo systemctl start exit_manjaro.service" than everything works.
When I do shutdown or reboot than this works but this happens on start-up and not on shutdown.
I tried a lot of things with Before and WantedBy but nothing do it.
I use manjaro openbox.
Can someone tell me what's wrong with this?
Thanks anyway
9 More Discussions You Might Find Interesting
1. What is on Your Mind?
I was testing Fedora 16 mostly to check the new features. One thing that caught my eye as a systems admin is the systemd which is incorporated in Fedora for quite a while now.
From the first look of it, this appears more close to Solaris's SMF. With parallelization capabilities, advanced... (0 Replies)
Discussion started by: admin_xor
0 Replies
2. UNIX for Advanced & Expert Users
I am writing a program that must determine certain things about services. How can I, or my program, determine which services are started automatically when a given target becomes active. It is my impression that just looking in the target's .wants directory is inadequate because of other... (2 Replies)
Discussion started by: Brandon9000
2 Replies
3. Linux
I'm on Arch and I have a strange issue with systemctl hibernate command. It hibernates and resumes just fine (I have TuxOnIce), but in the last stage of resume, it completely shuts down my laptop screen, so I cannot see anything even though I know the system resumed just fined and the desktop is... (1 Reply)
Discussion started by: lockheed
1 Replies
4. SuSE
Hello All,
OS: openSUSE 13.1 (Bottle) (armv7hl)
uname -a: Linux linux.site 3.14.14-cubox-i #1 SMP Sat Sep 13 03:48:24 UTC 2014 armv7l armv7l armv7l GNU/Linux
So this is my first attempt at starting a service at boot with systemd. I've done this with inittab in the past,
but I'm having... (0 Replies)
Discussion started by: mrm5102
0 Replies
5. Red Hat
Hi All,
I had a startup script (rc3.d/S01getinput) which will accept user inputs during the boot up in console. Basically it will prompt for input. It was working fine in RHEL6.
Now I have migrated to RHEL 7 and script gets executed as part of the boot up process. But it does not... (1 Reply)
Discussion started by: kalpeer
1 Replies
6. Linux
hi moring everyone,
i has used systemd-timer running the task, i set every 5 second execute 1 times,but the systemd-timer don't by that also random times execute.
what's reason.
testest.timer configure
------------------------------------------------------------------------
... (2 Replies)
Discussion started by: shean
2 Replies
7. UNIX for Beginners Questions & Answers
journalctl --since "tomorrow"
By idea to show magazines from tomorrow. As it is illogical.
Tell me what is the essence of the team with the key tomorrow?
Code tags please (1 Reply)
Discussion started by: alekseev
1 Replies
8. UNIX for Advanced & Expert Users
Hello all :)
no all us servers running on systemd :b::) so we would like to use journald also for remotelogging. And yes we have configured that and it is running fine. We have configured the first 3 servers to send logs to central journaldservice with https and certificate. So on the... (0 Replies)
Discussion started by: darktux
0 Replies
9. UNIX for Advanced & Expert Users
Hi,
systemd cant start my script, but it work, at command prompt.
Code and execute at command prompt
#cat collector.sh
#!/bin/bash
case $1 in
start)
/home/postgres/scripts/pgwatch2/pgwatch2.sh
/home/postgres/scripts/pgwatch2/pgwatch2_UI.sh
;;
... (7 Replies)
Discussion started by: kvaikla
7 Replies
LEARN ABOUT OPENDARWIN
systemd-halt.service
SYSTEMD-HALT.SERVICE(8) systemd-halt.service SYSTEMD-HALT.SERVICE(8)
NAME
systemd-halt.service, systemd-poweroff.service, systemd-reboot.service, systemd-kexec.service, systemd-shutdown - System shutdown logic
SYNOPSIS
systemd-halt.service
systemd-poweroff.service
systemd-reboot.service
systemd-kexec.service
/lib/systemd/systemd-shutdown
/lib/systemd/system-shutdown/
DESCRIPTION
systemd-halt.service is a system service that is pulled in by halt.target and is responsible for the actual system halt. Similarly,
systemd-poweroff.service is pulled in by poweroff.target, systemd-reboot.service by reboot.target and systemd-kexec.service by kexec.target
to execute the respective actions.
When these services are run, they ensure that PID 1 is replaced by the /lib/systemd/systemd-shutdown tool which is then responsible for the
actual shutdown. Before shutting down, this binary will try to unmount all remaining file systems, disable all remaining swap devices,
detach all remaining storage devices and kill all remaining processes.
It is necessary to have this code in a separate binary because otherwise rebooting after an upgrade might be broken -- the running PID 1
could still depend on libraries which are not available any more, thus keeping the file system busy, which then cannot be re-mounted
read-only.
Immediately before executing the actual system halt/poweroff/reboot/kexec systemd-shutdown will run all executables in
/lib/systemd/system-shutdown/ and pass one arguments to them: either "halt", "poweroff", "reboot" or "kexec", depending on the chosen
action. All executables in this directory are executed in parallel, and execution of the action is not continued before all executables
finished.
Note that systemd-halt.service (and the related units) should never be executed directly. Instead, trigger system shutdown with a command
such as "systemctl halt" or suchlike.
SEE ALSO
systemd(1), systemctl(1), systemd.special(7), reboot(2), systemd-suspend.service(8)
systemd 237 SYSTEMD-HALT.SERVICE(8)