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
service(8)						      System Manager's Manual							service(8)

NAME
service - run a System V init script SYNOPSIS
service SCRIPT COMMAND [OPTIONS] service --status-all service --help | -h | --version DESCRIPTION
service runs a System V init script in as predictable an environment as possible, removing most environment variables and with the current working directory set to /. The SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT. The supported values of COMMAND depend on the invoked script. service passes COMMAND and OPTIONS to the init script unmodified. All scripts should support at least the start and stop commands. As a special case, if COMMAND is --full-restart, the script is run twice, first with the stop command, then with the start com- mand. service --status-all runs all init scripts, in alphabetical order, with the status command. EXIT CODES
service calls the init script and returns the status returned by it. FILES
/etc/init.d The directory containing System V init scripts. ENVIRONMENT
LANG, TERM The only environment variables passed to the init scripts. SEE ALSO
/etc/init.d/skeleton, update-rc.d(8), init(8), invoke-rc.d(8). Jan 2006 service(8)
All times are GMT -4. The time now is 01:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy