Forum Discussion
ooker
Sep 03, 2023Copper Contributor
How to write a script to start a Docker container and stop WSL safely when the container stops?
I’m writing a PowerShell script to start a container and stop WSL safely when the container stops. Here is my attempt: $ContainerName = 'tranky'
$DockerDesktopPath = "C:\Program Files\Docker\Docker\...
ooker
Sep 08, 2023Copper Contributor
Actually I was broadening my topic and not talking about Docker specifically. Like, if I'm writing a program and want to register my program's events to the OS so that users can take it from there, what should I do? Only signalling via child process seems limited to me. I guess the only way to communicate with the OS is to pack all the information in the process title. I see that the Task Scheduler is something in the right way.
LainRobertson
Sep 08, 2023Silver Contributor
Okay, so setting Docker aside, there's no mandated standard.
The closest thing to a standard would be making use of the Windows event logs, where your application would write key events to either the Application log (most common as it's the oldest and therefore the most well-known log) or the Application and Services Logs node (newer, uses and different implementation and isn't widely used by vendors outside of Microsoft - though it is growing.)
Ultimately it's entirely up to the developer how they wish to inform of key events - or even to not inform at all. Again, there is no mandated standard for this.
But this is a discussion for another forum as it is entirely unrelated to PowerShell.
Cheers,
Lain