Automate terminal suspend/resume using Webhook

If you are not using Wazaterm, you can stop billing for the Wazaterm instances by suspending or terminating the instance. The difference between Suspend and Terminate is as follows:

Suspend

Suspend saves the currently running process to the Swap area and then terminates the instance; Resume restores the processes and you can use it from the suspended state. (This is generally called hibernate.) Since the process is saved to the swap area, the suspend/resume time will be proportional to the swap memory used. Suspend/resume does not change the memory or CPU type, it behaves like sleep on a PC.

Terminate

You can change the memory or CPU type by terminating it. In this case, the running process will be terminated, which is the behavior of shutdown in PC.


Suspend/Terminate takes some time, so you can't use the terminal as soon as you open the screen like a laptop. This can be a bit frustrating. To avoid this, Wazaterm allows you to use a Webhook for each terminal. There is a curl command in the Webhook section of the top page.



If you simply put this in your crontab, you can suspend/resume the terminal at the time you need. I also work with the iOS focus and shortcuts app to enable location-based resume/suspend of the terminal. Please refer to the following link to set it up.