Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Run one service after another service has finished - systemd Post 303004645 by guilliber on Thursday 5th of October 2017 05:06:02 PM
Old 10-05-2017
Run one service after another service has finished - systemd

Hi all
I would like to know how to run task2.service after task1.service has finished.

task1.service has a timer (task1.timer), that makes it run every 5 minutes
Code:
OnCalendar=*:0/5

task2.service is basically a script, that has to work on the files created after task1 has finished.
This is what I have so far:
Code:
# task2.service

[Unit]
Description=Task2
After=network.target

[Service]
Type=oneshot
ExecStart=/media/script.sh
TimeoutStartSec=1min30s

Now, I don't know if I need a timer for task2 too, or if I should include under [Unit]
Code:
Requires=task1.service
After=network.target task1.service

Any help would be appreciated!
 

4 More Discussions You Might Find Interesting

1. SCO

run dos telnet service

hi , i need a telnet server for dos(telnet from unix server to dos client) , so how can i run telnet service on dos ? (0 Replies)
Discussion started by: shrb78
0 Replies

2. Cybersecurity

run dos telnet service

hi , i need a telnet server for dos(telnet from unix server to dos client) , so how can i run telnet service on dos ? (0 Replies)
Discussion started by: shrb78
0 Replies

3. Windows & DOS: Issues & Discussions

run dos telnet service

hi , i need a telnet server for dos(telnet from unix server to dos client) , so how can i run telnet service on dos ? (0 Replies)
Discussion started by: shrb78
0 Replies

4. Solaris

run a service via startup script (correct me if I am wrong)

Environment Solaris 9 I have configured the Solaris9 as NTP client in which Solaris9 is syncing the time with a windows2008 R2 Server which is runing fine. Now I want that the xntpd service should start at startup. I did this via a script. Kindly correct if I did any thing wrong: 1.)Made... (9 Replies)
Discussion started by: z_haseeb
9 Replies
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)
All times are GMT -4. The time now is 05:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy