Author image Olli Hollmen
and 1 contributors


Citrix::SessOp - Disconnect or Logoff from an existing Citrix Session.


Control Citrix session state by launching associated command line utilities. The module user should take care of gaining authority to (by host/user, whatever) execute these commands successfully on Citrix Farm as the current process runtime user (It seems Citrix commands and associated protocol map the user 1-to-1 to the server end). Lacking this permission the commands will fail.

Module aims to provide proper return values and error messages when things fail, but this is not a substitute for first taking care of of proper permissions (for lauching Citrix commands) with your local Citrix Admin.


  use Citrix::SessOp;
  my $fms = Citrix::getfarms('idx' => 1);
  my $farmctx = $fms->{'cairo'};
  my $csop = Citrix::SessOp->new($farmctx);
  # Disconnect (leaves session idle, to "returnable" state)
  $err = $csop->disconnect("the-cx-host-12:8879");
  # Log Off Completely (Terminating UNIX X-Windows session)
  $err = $csop->logoff("the-cx-host-12:8879");


$csop = Citrix::SessOp->new($farmctx);

Create a new Citrix session operation by Citrix::Farm context ($farmctx). The ops available later are disconnect() / logoff() (See method docs on each for details). Return session operation instance.

$err = $cop->disconnect("the-cx-host-12:8879");

Disconnect a Citrix session By Host Session ID ($hostsess in format "$hostname:$sessid"). Disconnect persists the session state (leaves applications in the state they were before disconnect). Return 0 for success, 1 (and up) for errors.

$err = $cop->logoff("the-cx-host-12:8879");

Logoff from a Citrix session By Host Session ID ($hostsess in format "$hostname:$sessid"). Logging off completely destroys the session state (closes apps and terminates X-Windows session). Return 0 for success, 1 (and up) for errors.