Posts by stib@aus.social
(DIR) Post #B5l0Xx9VERFAqeBlEu by stib@aus.social
0 likes, 0 repeats
This is old news to anyone with actual command-line skills, but it saved me today when doing a Blender render that kept crashing. I normally render from the command line because it means I can keep posting toots, er, I mean working productively for my employer in the foreground while it's rendering, and because it's usually faster (especially if you can run multiple instances). Since I set up my scene to render an image sequence with overwriting turned off I can restart the render each time and pick up where it left off. But because command line, I can automate that process. In zsh (it will probably work on Bash or other shells I dunno) I do:`blender -b '/path/to/my/project.blend' -a; while [[ $? != 0 ]]; do; echo "!!!! Oh bollocks !!!!"; blender -b '/path/to/my/project.blend' -a; done`The guts of it is the `while` loop. This will loop as long as `$?` is not equal to 0. `$?` is a variable that holds the result of the previous operation, which is 0 if the previous operation succeeds. So if blender crashes it returns some non-zero return code, and the loop starts it up again.For info on rendering from the command line: https://docs.blender.org/manual/en/latest/advanced/command_line/render.html#blender #ShellScripting #CommandLine---EDIT----Check the replies for a more terse and elegant way to do this. Also, here's a screenie of it in action, you can see it crashing and then starting again. This is on OSX so there's a dialog box that pops up, luckily the shell ignores the user's rsponse and continues anyway.1/2
(DIR) Post #B5l0XxjJ5JsqdgwM2y by stib@aus.social
0 likes, 0 repeats
@trouble Yep, that works in zsh, I tried: `while ! foobar; do echo "ohai"; foobar; done`
(DIR) Post #B5l0Xy4DpYc7gYj3eC by stib@aus.social
0 likes, 0 repeats
@trouble ah, gotcha. Is there a difference between `while ! <cmd>` and `until <cmd>`?
(DIR) Post #B5l0Y4Rq6f4RTXp0IC by stib@aus.social
0 likes, 0 repeats
For more bells and whistles I've added a function that looks for orphaned placeholder files:`blender -b /path/to/my/project.blend -a; while [[ $? != 0 ]]; doecho "\n############## oh bollocks ##############\n"; find "/path/to/my/render/folder/" -size -1k -delete; blender -b /Volumes/4TB-Fastboi/MV11834-Halloween\ Cards\ 2025/Project\ Files/Bat/bat1.blend -adone`This deletes all files smaller than 1k (obviously don't do this if you're rendering very small images) using the `find` command and `-size -1k` as the parameter.There are also command line programs like imagemagick or pngcheck that can check images, you could run these to check through all the rendered files to make sure they're not corrupted. I've done that in the past when having issues rendering using multiple machines.