I see two ways to do what you want.
Run a time based profile and set it to repeat after every n
minutes. Then follow your logical actions in the task of what to do when it crashes.
The other option (since the former doesn't give control on seconds but minutes and hours) is to execute the task manually or at some point automatically (say at 10:00 AM) but make an infinitely looping task.
For example, consider the following actions:
Note: Anything with and between <>
has to be replaced with your custom values.
Code → Run Shell
- Command:
<YOUR_COMMAND>
- Store Output In:
%Grep
Create this action based on what to do when the above command returns nothing i.e. when the process is not running.
When doing so, set an 'If' condition under that action. E.g. under the action App → Launch App, the If
condition would be %Grep
Isn't Set
.
Note that I'm not talking about using a separate If
action.
- Add a wait of the amount of seconds/minutes/hours you want using Task → Wait
Now is the time to make an infinite loop. Use the action Task → Goto
- Type: Action Number
- Number: 1
All we've done here is to execute a command then execute an action if only the first command didn't yield anything, then wait for sometime and then repeat the whole procedure.
At some point, you would want to get rid of that infinite loop. You can either consider disabling and re-enabling Tasker or make a stop action in another task using Task → Stop, and execute it manually.