Proyecto

General

Perfil

Descargar (1,58 KB) Estadísticas
| Rama: | Revisión:
program serveralumnolinexltsp;

{$mode objfpc}{$H+}

uses
cthreads,
Classes, SysUtils, CustApp, globales, demonio, clservidor, clcomandosroot;

type

{ TMyApplication }

TMyApplication = class(TCustomApplication)
protected
procedure DoRun; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
end;

{ TMyApplication }

procedure TMyApplication.DoRun;
const
ESTADOUSUARIO='who -u | grep %s|grep -v -c grep';
var
EstadoUsu:String;
begin
// quick check parameters
if g_maquina_profe then
begin
Terminate;
exit
end;
if (g_contador_estado>200) then
begin
EstadoUsu:=Format(ESTADOUSUARIO,[miservidor.UsuarioAlumno]);
if Trim(HallarDatos(EstadoUsu))='0' then
begin
Ejecutar1('killall x11vnc >/dev/null 2&>1');
Terminate;
exit;
end;
g_contador_estado:=0;
end;
inc(g_contador_estado);
IF g_finalizar then terminate;

{ add your program here }
// stop program loop

sleep(50);
//Terminate;
end;

constructor TMyApplication.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException:=True;
end;

destructor TMyApplication.Destroy;
begin
inherited Destroy;
end;



var
Application: TMyApplication;

{$IFDEF WINDOWS}{$R serveralumnolinex.rc}{$ENDIF}

begin
Application:=TMyApplication.Create(nil);
Application.Run;
Application.Free;
end.

(10-10/10)