vncserver: extract DeleteLogLeftFromPreviousXvncRun()

KASM-1609_select_de_to_run
Dmitry Maksyoma 4 years ago
parent 06e9e92ee1
commit 65f957695e

@ -32,6 +32,8 @@
&ParseAndProcessCliOptions(); &ParseAndProcessCliOptions();
$vncPort = 5900 + $displayNumber; $vncPort = 5900 + $displayNumber;
$desktopName = $opt{'-name'} || "$host:$displayNumber ($ENV{USER})"; $desktopName = $opt{'-name'} || "$host:$displayNumber ($ENV{USER})";
$desktopLog = "$vncUserDir/$host:$displayNumber.log";
$pidFile = "$vncUserDir/$host:$displayNumber.pid";
&CreateDotVncDir(); &CreateDotVncDir();
@ -46,16 +48,13 @@ if ($kasmAuthEnabled && !&AtLeastOneUserConfigured()) {
@kasmPasswdUsers = &LoadKasmPasswdUsers(); @kasmPasswdUsers = &LoadKasmPasswdUsers();
} }
$desktopLog = "$vncUserDir/$host:$displayNumber.log";
unlink($desktopLog);
&SetupXauthorityFile(); &SetupXauthorityFile();
# Now start the X VNC Server # Now start the X VNC Server
$cmd = &ConstructXvncCmd(); $cmd = &ConstructXvncCmd();
$pidFile = "$vncUserDir/$host:$displayNumber.pid"; &DeleteLogLeftFromPreviousXvncRun();
&StartXvncAndRecordPID(); &StartXvncAndRecordPID();
&WaitForXvncToStart(); &WaitForXvncToStart();
@ -926,6 +925,10 @@ sub StartXvncAndRecordPID {
system("$cmd & echo \$! >$pidFile"); system("$cmd & echo \$! >$pidFile");
} }
sub DeleteLogLeftFromPreviousXvncRun {
unlink($desktopLog);
}
sub StartXvncWithSafeFontPath { sub StartXvncWithSafeFontPath {
if ($fpArgSpecified) { if ($fpArgSpecified) {
warn "\nWARNING: The first attempt to start Xvnc failed, probably because the font\n"; warn "\nWARNING: The first attempt to start Xvnc failed, probably because the font\n";

Loading…
Cancel
Save