I have made a small apple script (calling a shell script using ssh) to remotely shutdown/hibernate my windows machine. I export the script as application so I can easily call it from my raycast search.
set question to display dialog "Are you sure you want to hibernate pDesktop?" buttons {"Yes", "No"} default button 1 with icon caution
set answer to button returned of question
if answer is equal to "Yes" then
do shell script "ssh -t [email protected] 'shutdown.exe /h'"
end if
This works fine, however after executing the script (or even just the shell ssh command in a terminal), the terminal on mac os hangs (because the remote server closes the connection) and I have to kill the process.
Is there any method to prevent this? Or a better/recommended method to remotely send a shutdown command?
Thanks phil
do shell script
command, in this use case, have a look at: I want to start a background server process; how do I make do shell script not wait until the command completes? in the Technical Note TN2065do shell script
in AppleScript