How to shutdown the computer automatically after a render

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

Videoneth

  • Posts: 1678
  • Joined: Fri Nov 13, 2020 11:03 pm
  • Warnings: 1
  • Real Name: Maxwell Allington

How to shutdown the computer automatically after a render

PostThu Apr 15, 2021 6:04 pm

Shrinivas Ramani wrote:Hi

Resolve 17 has the option for a post-render script (Render Settings > Advanced > Trigger Script at end of render job). You can queue up your render jobs, add a script to the last job in the queue and use that script to set your system to sleep/shutdown/spin-down drives, or even send an email notification so someone can push a button.

Please refer to the What's New in Resolve 17 document (starting page 349)

Regards
Shrinivas

So for people on Windows 10
(I'm sure there are other commands, I don't know, but this works for me) :

1) Create a LUA script with this code in it (just use the notepad) :
Code: Select all
manager = resolve:GetProjectManager()
manager:SaveProject()
strProgram = '"C:\\Windows\\System32\\shutdown.exe" /s /t 00'
os.execute(strProgram)

2) Put the file in C:\ProgramData\Blackmagic Design\DaVinci Resolve\Fusion\Scripts\Deliver - and call it "Shutdown.lua" for example

The first two lines will make Resolve save your project, then it will shut down the computer directly.
/t 00 is the time before the shutting down process (in seconds). You can delay it by giving a duration in seconds.

You can find all the other options here : https://docs.microsoft.com/en-us/window ... s/shutdown

I don't know the commands for Linux or MacOS, but I'm sure it can be found very easily.

I'm sure there are tons of other possibilities, like playing an audio notification, etc. anything that can be triggered by a script.

PS.
Don't test it like I did, with all my applications opened and work not saved :lol:
Attachments
script2.jpg
script2.jpg (15.07 KiB) Viewed 7433 times
script.jpg
script.jpg (16.7 KiB) Viewed 7433 times
Last edited by Videoneth on Fri Apr 16, 2021 1:50 pm, edited 2 times in total.
Windows 10
19b
nVidia 3090 - 552.22
Offline

TYKHAN

  • Posts: 179
  • Joined: Fri Aug 05, 2016 3:44 pm
  • Real Name: Abdul Majeed

How to shutdown the computer automatically after a render

PostThu Apr 15, 2021 9:02 pm

Working fine thanx.
Btw does this close davinci resolve AND shutdown the pc?

Sent from my iPhone using Tapatalk
OS: WIN10 Pro 22H2 Build 19045.3448 64-bit ENG
BOARD: ASUS X99-E WS
CPU: Intel Xeon E5-1650 v3 3.5GHz
RAM: 4x 16 Kingston DDR4 2133MHz ECC
GPU: GeForce GTX 1080 Ti Driver v472.12
PSU: Corsair RM750w
DaVinci Resolve Studio 18.6.1 build 4
Offline
User avatar

Marc Wielage

  • Posts: 11017
  • Joined: Fri Oct 18, 2013 2:46 am
  • Location: Hollywood, USA

Re: How to shutdown the computer automatically after a rende

PostThu Apr 15, 2021 11:05 pm

What I've done for years is ballpark-guess how long the render will take, then set an OS timer that adds another hour to that time (for safety) and shuts down the system. If Resolve is finished, it will allow the OS to safely exit the program and shut down, provided you have nothing else running (like an unsaved document in the background).
marc wielage, csi • VP/color & workflow • chroma | hollywood
Offline

Videoneth

  • Posts: 1678
  • Joined: Fri Nov 13, 2020 11:03 pm
  • Warnings: 1
  • Real Name: Maxwell Allington

Re: How to shutdown the computer automatically after a rende

PostThu Apr 15, 2021 11:50 pm

TYKHAN wrote:Working fine thanx.
Btw does this close davinci resolve AND shutdown the pc?

Sent from my iPhone using Tapatalk


This particular one is just sending a signal to shut down the whole computer, regardless of what's oppened (the same way you would do from the start menu).

I added two lines at the beginning of the code. It will save your current project (in Resolve) before shutting down the computer.
Last edited by Videoneth on Fri Apr 16, 2021 1:57 pm, edited 3 times in total.
Windows 10
19b
nVidia 3090 - 552.22
Offline

Videoneth

  • Posts: 1678
  • Joined: Fri Nov 13, 2020 11:03 pm
  • Warnings: 1
  • Real Name: Maxwell Allington

Re: How to shutdown the computer automatically after a rende

PostThu Apr 15, 2021 11:56 pm

Marc Wielage wrote:What I've done for years is ballpark-guess how long the render will take, then set an OS timer that adds another hour to that time (for safety) and shuts down the system. If Resolve is finished, it will allow the OS to safely exit the program and shut down, provided you have nothing else running (like an unsaved document in the background).

You can try it, by changing 00 by 3600, so it would wait one hour before shutting down (I didn't test anything else than the immediate shut down)
Windows 10
19b
nVidia 3090 - 552.22
Offline

Videoneth

  • Posts: 1678
  • Joined: Fri Nov 13, 2020 11:03 pm
  • Warnings: 1
  • Real Name: Maxwell Allington

Re: How to shutdown the computer automatically after a rende

PostFri Apr 16, 2021 1:58 pm

I added two lines to the code so the project is saved beforehand.
Code: Select all
manager = resolve:GetProjectManager()
manager:SaveProject()
strProgram = '"C:\\Windows\\System32\\shutdown.exe" /s /t 00'
os.execute(strProgram)
Windows 10
19b
nVidia 3090 - 552.22
Offline
User avatar

Phil999

  • Posts: 402
  • Joined: Tue Jun 11, 2019 11:12 am
  • Real Name: Philipp Straehl

Re: How to shutdown the computer automatically after a rende

PostFri Apr 16, 2021 8:23 pm

thank you Maxwellx.
Offline

Thom Guida

  • Posts: 116
  • Joined: Mon Nov 20, 2017 3:15 pm
  • Location: Nujerzistan, a state pka New Jersey

Re: How to shutdown the computer automatically after a rende

PostMon Apr 19, 2021 3:28 pm

Phil999 wrote:thank you Maxwellx.


Dittos

"I now dub thee, Maxwellx Smart."

*Google* Maxwell Smart for the reference/joke.
RSD v.18.04, BMD KB & Micro Panel
Win10 Pro V21H1 OS build 19043.1889
Nv GTX 3090 dV516.94
Ryzen 3900x@3.8; 64GB
IntelNicI211 12.15.180.0/Aquantia 10TbNic
C:\Sam980 Pro NvMe 2TB on ASRock x570 Taichi MB v3.0; QNAP Cache 2TB NVMe Raid6 42TB.
Offline

Videoneth

  • Posts: 1678
  • Joined: Fri Nov 13, 2020 11:03 pm
  • Warnings: 1
  • Real Name: Maxwell Allington

Re: How to shutdown the computer automatically after a rende

PostSun Sep 05, 2021 10:35 pm

Thom Guida wrote:
Phil999 wrote:thank you Maxwellx.


Dittos

"I now dub thee, Maxwellx Smart."

*Google* Maxwell Smart for the reference/joke.

lol
Windows 10
19b
nVidia 3090 - 552.22
Offline
User avatar

jamedia

  • Posts: 1062
  • Joined: Sun Apr 14, 2019 7:21 pm
  • Location: Birmingham UK
  • Real Name: Chris Hills

Re: How to shutdown the computer automatically after a rende

PostTue Sep 07, 2021 9:56 pm

Maxwellx wrote:I added two lines to the code so the project is saved beforehand.
Code: Select all
manager = resolve:GetProjectManager()
manager:SaveProject()
strProgram = '"C:\\Windows\\System32\\shutdown.exe" /s /t 00'
os.execute(strProgram)


If the timeout period is greater than 0, the /f parameter is implied.
/f Forces running applications to close without warning users.

The best option might be to change the line to strProgram = '"C:\\Windows\\System32\\shutdown.exe" /s /t 30'
so that it starts the shutdown program with 30 second delay.
Then add a line to close Resolve
Code: Select all
Quit()

This will end the script and close Resolve but won't stop the running shutdown program which will shut down after resolve is closed.
www.JAmedia.uk
[AMD Ryzen 5950X 16 Core CPU | 128GB Ram | NVIDIA 3080TI 12GB ]
[MB ASUS ProArt B550| C Drive:; 1TB M2 980 Pro | D Drive; 2TB M2 970 EVO ]
[ Win 11 home |Resolve Studio V18.6 | Speed Editor via USB | Scarlett 2i2 3rd Gen| ]
Offline
User avatar

capthook

  • Posts: 208
  • Joined: Thu Aug 15, 2019 12:43 am
  • Real Name: Jack Jones

Re: How to shutdown the computer automatically after a rende

PostWed Sep 08, 2021 11:23 am

good stuff - very useful
better than using a shortcut C:\Windows\System32\shutdown.exe -s -t xx and guessing for xx,
that I've used in the past, like MarC.
Speed Warp etc can add varying 'extra' time to the render so....
Your method is 'keyed' by Resolve finishing render - nice.
Thanks!
(and oh, the file *does* need to be .lua - not .txt for Resolve to recognize it, as you suggested)
DaVinci Resolve Studio 18.6.6 | Nvidia Studio 537.42 | Mavic 2P | GH6 | Ronin SC
i9 13900K | 64GB 5600MHz DDR5 RAM | RTX4080 16GB | (4) 990Pro 2tb m.2 | Windows 11
Offline

alelom

  • Posts: 6
  • Joined: Fri Jun 16, 2023 8:25 am
  • Real Name: Alessio Lombardi

Re: How to shutdown the computer automatically after a rende

PostWed Jun 21, 2023 9:39 am

Very useful thanks!

Just adding that you can also have a "hibernate" script by doing "shutdown /h" instead:

Code: Select all
manager = resolve:GetProjectManager()
manager:SaveProject()
strProgram = '"C:\\Windows\\System32\\shutdown.exe" /h'
os.execute(strProgram)


(This requires to have hibernate enabled in Windows.)

Cheers!
Offline

docdoc

  • Posts: 27
  • Joined: Thu Aug 23, 2018 3:20 pm
  • Location: Germany
  • Real Name: Felix Herrberg

Re: How to shutdown the computer automatically after a rende

PostThu Aug 17, 2023 1:55 pm

Very nice! Is there also a script like this for Mac?
Offline
User avatar

jamedia

  • Posts: 1062
  • Joined: Sun Apr 14, 2019 7:21 pm
  • Location: Birmingham UK
  • Real Name: Chris Hills

Re: How to shutdown the computer automatically after a rende

PostThu Aug 17, 2023 5:07 pm

docdoc wrote:Very nice! Is there also a script like this for Mac?


It should be equally simple to do for a POSIX OS.
Just google scripting for Mac.
It is worth learning basic scripting
www.JAmedia.uk
[AMD Ryzen 5950X 16 Core CPU | 128GB Ram | NVIDIA 3080TI 12GB ]
[MB ASUS ProArt B550| C Drive:; 1TB M2 980 Pro | D Drive; 2TB M2 970 EVO ]
[ Win 11 home |Resolve Studio V18.6 | Speed Editor via USB | Scarlett 2i2 3rd Gen| ]

Return to DaVinci Resolve

Who is online

Users browsing this forum: Alexrocks1253, Bing [Bot], Google [Bot], panos_mts and 165 guests