this is an apple script to toggle a restart of a specific UTM virtual machine. Replace the name Linux Ubuntu with your VM's name
Created
April 23, 2024 09:07
-
-
Save pew/67d38a063edc7e8d6d9a942e4d61e1f9 to your computer and use it in GitHub Desktop.
utm restart vm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tell application "UTM" | |
| set vm to virtual machine named "Linux Ubuntu" | |
| set vmStatus to get status of vm | |
| if vmStatus is started then | |
| stop vm | |
| repeat until (get status of vm) is stopped | |
| delay 1 -- checks every second to see if the VM has stopped | |
| end repeat | |
| start vm | |
| else if vmStatus is stopped then | |
| start vm | |
| end if | |
| tell application "System Events" to set visible of process "UTM" to false | |
| end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment