Timeline for I need to automatically rerun a command if the previous output contains a specific string
Current License: CC BY-SA 4.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 9, 2020 at 9:54 | vote | accept | markpaterson | ||
| Feb 9, 2020 at 5:32 | answer | added | icarus | timeline score: 1 | |
| Feb 9, 2020 at 5:10 | comment | added | markpaterson | @Haxiel Ok thanks for the explanation. I tried it and it didn't work, unfortunately. It just returned to the command prompt and stayed there. This was for the main kind of error I get, which says that a file can't be written. However, it did work when I forced a different kind of error where it couldnt find the render directory - but this basically never happens. Thanks for your help though, I learned something new that I might be able to put to use in the future! | |
| Feb 9, 2020 at 4:55 | comment | added | Haxiel | @markpaterson I'll explain exit codes in a bit more detail. Applications on Unix/Linux systems return a value - a number - when they finish execution. This is called an exit code. By convention, an exit code of 0 implies success, and any other number implies a failure. Since this is a standard practice, I assume that the aerender program exits with a non-zero value if the render fails. The until loop works by running your aerender command and checking its exit code. It re-runs the command until the exit code becomes zero. Can you give it a try and see if works? | |
| Feb 9, 2020 at 4:13 | comment | added | markpaterson | @Haxiel i'm not sure. Even when there's a render error, it still seems to exit gracefully. There's no sudden crash. | |
| Feb 9, 2020 at 4:10 | comment | added | markpaterson | @icarus this almost works. I do get the command to repeat using your suggestion, however i see NO output from aerender at all. I only see the line that grep detects followed by "repeating command". I need to see the regular output of aerender too. Is this achievable? | |
| Feb 9, 2020 at 3:42 | comment | added | Haxiel | If the aerender program has proper exit codes, you could use an until loop: until ..aerender... ; do : ; done. The loop will run unti the aerender command exits successfully. | |
| Feb 8, 2020 at 21:22 | history | edited | icarus | edited tags | |
| Feb 8, 2020 at 21:21 | comment | added | icarus | while /App... | grep 'WARNING...' ; do echo "repeating command" ; done | |
| Feb 8, 2020 at 21:09 | history | asked | markpaterson | CC BY-SA 4.0 |