Run one service after another service has finished - systemd


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Run one service after another service has finished - systemd
# 1  
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!
# 2  
Old 10-05-2017
why not have task 1 start task 2. just make sure that the previous task2 is complete before starting another task1
# 3  
Old 10-06-2017
I would like to understand the way systemd works and I would like to learn it that way, if it is possible. Thank you.
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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
Login or Register to Ask a Question