Is there a way to run tasks only if a specific application is running?

Questions about Cobian Reflector
Post Reply
gosukaos
Posts: 2
Joined: 12 Nov 2023, 20:24

Is there a way to run tasks only if a specific application is running?

Post by gosukaos »

I need to backup a directory every 30 minutes, but only when a specific application is running. The only time those files are changed is when the application is running.

Is there a way to do this?
User avatar
cobian
Site Admin
Posts: 4611
Joined: 31 Oct 2020, 01:25
Location: Sweden
Contact:

Re: Is there a way to run tasks only if a specific application is running?

Post by cobian »

Not that I am aware of. But why don't you use a timer *incremental* task? This will have the same effect.
--
Luis Cobian
Cobian Backup's creator
gosukaos
Posts: 2
Joined: 12 Nov 2023, 20:24

Re: Is there a way to run tasks only if a specific application is running?

Post by gosukaos »

I'm currently using incremental. The only thing about this is it creates a new folder everytime the task is run even if there's nothing to backup. Other than that it does it's job.
User avatar
cobian
Site Admin
Posts: 4611
Joined: 31 Oct 2020, 01:25
Location: Sweden
Contact:

Re: Is there a way to run tasks only if a specific application is running?

Post by cobian »

There is surlely some clever way by using some Pre-Backup event but I'm really out of ideas.
--
Luis Cobian
Cobian Backup's creator
ira
Posts: 101
Joined: 02 Nov 2021, 19:16

Re: Is there a way to run tasks only if a specific application is running?

Post by ira »

You might be able to use get-process in a powershell script to get that information.
User avatar
cobian
Site Admin
Posts: 4611
Joined: 31 Oct 2020, 01:25
Location: Sweden
Contact:

Re: Is there a way to run tasks only if a specific application is running?

Post by cobian »

Should work, yes.
--
Luis Cobian
Cobian Backup's creator
flako666
Posts: 28
Joined: 01 Oct 2021, 02:04

Re: Is there a way to run tasks only if a specific application is running?

Post by flako666 »

Simply put, you can use a pre-backup control/script using tasklist or pslist.
Similar to:

for /f "tokens=1,2, 8 delims== " %%A in ('C:\TASKS\PSTools\pslist ') do (
if "%%A" == "MiAPP" (
run Backup

)
)
)
Post Reply