I'm shutting down the computer, while OBS is running and the virtual cam is active. In my opinion this should simply close OBS without any crash marks.
I would think so too, but I have several examples to say it doesn't, between this forum and my own experience.
For just a peek under the hood, there are a bunch of different "signals" that can be sent to a running process to make it do things. Some of them are:
- Shut down gracefully as if the user clicked the close button, but implemented as a general-purpose signal for the app to figure out.
- Shut down immediately ("crash close"), also implemented as a general-purpose signal for the app itself to deal with.
- Intercepted by the operating system so that the app never sees it, and forces it to end right there.
The OS shutdown procedure includes sending the graceful-close signal to everything, waiting a bit, and then asking the user to force-close whatever remains.
When I wrote the management script for a complex rig (ordered startup, wait for done, then ordered shutdown), I could never find a close signal that didn't make OBS complain on the next startup. So I added the
--disable-shutdown-check
flag on OBS's command line. My complete logic then, to start two simultaneous instances of OBS is:
Bash:
echo "Start OBS Master (feed to meeting)"
obs --verbose --unfiltered_log --disable-updater --disable-shutdown-check --multi --studio-mode --profile "$OBS_PROFILE" --collection "$OBS_PROFILE" --startvirtualcam > /dev/null &
PID_MASTER=$!
sleep 10
echo
echo "Start OBS Slave (local display and recording)"
obs --verbose --unfiltered_log --disable-updater --disable-shutdown-check --multi --studio-mode --profile "Meeting_Slave" --collection "Meeting_Slave" > /dev/null &
PID_SLAVE=$!
sleep 10
echo
prints to the terminal, as an indication to the user of what it's doing.
The
$NAME
's are variables, so I can use the same script for several different things.
sleep
pauses there for so many seconds.
> /dev/null
keeps the terminal cleaner by preventing messages from that command from being displayed.
&
on the end continues on without waiting for that command to finish.
$!
is the process ID (PID) of the previous command that we're not waiting for. I assign it to a variable so I can send the shutdown signal to it later.
And for completeness:
Bash:
echo
echo "Close OBS Slave"
kill -TERM "$PID_SLAVE"
sleep 5
echo
echo "Close OBS Master"
kill -TERM "$PID_MASTER"
sleep 5
-TERM
is the official name for the specific signal that I'm sending. Like I said, I tried a bunch there, and couldn't find one that OBS didn't complain about. Hence, the flag on startup to just not complain.