Command Line

This chapter gives an overview of how to manage a ThinLinc cluster using the command line. Detailed descriptions of available commands can be found in Commands on the ThinLinc Server.

Note

It is recommended to configure sudo so that these commands can be run without having to specify an absolute path. See Run ThinLinc administration commands using sudo for details.

Managing Sessions

Users’ sessions can be examined and controlled using tlctl session. With this tool, it is possible to list sessions currently running on the cluster:

$ sudo tlctl session list
USER   DISPLAY  AGENT               STATUS     AGE
========================================================
alice  12       agent1.example.com  connected  11 day(s)
bob    32       agent2.example.com  connected  5 hour(s)

Listed 2 session(s).

If only some sessions are interesting, then it is possible to list just those:

$ sudo tlctl session list --agent agent2.example.com
USER  DISPLAY  AGENT               STATUS     AGE
=======================================================
bob   32       agent2.example.com  connected  5 hour(s)

Listed 1 session(s).

It may happen that something has gone wrong with a user’s session and needs to be restarted. The tlctl session command can then be used to terminate that session:

$ sudo tlctl session terminate --user bob
Refreshing session information...

Terminating:
USER  DISPLAY  AGENT
=================================
bob   32       agent2.example.com

Summary:
  Terminate 1 session(s)

Is this ok? [y/N]: y

Notifying Users

Sometimes it may be necessary to inform users of important events, e.g. that a server needs to be restarted. Historically, the wall command was used for this, but it is mostly ignored by desktop environments and users may not have a terminal open.

ThinLinc includes the tool tl-notify that instead uses the notification mechanism built into most desktop environments. With this tool, it is easy to send a message to users:

$ sudo tl-notify The system will be restarted in one hour

Note that this command only notifies the users on the agent where the command is run. It is therefore recommended to also use tl-ssh-all:

$ sudo tl-ssh-all tl-notify The system will be restarted in one hour

Cluster Load

The current status of ThinLinc’s load monitoring can be examined using tlctl load. The command tlctl load list can be used to get a brief overview of the entire cluster:

$ sudo tlctl load list
AGENT               USERS  MEM  CPU  RATING
===========================================
agent1.example.com     11  14%   0%   10.85
agent2.example.com     10  10%   0%   29.88

More details can be fetched about a specific agent using tlctl load show:

$ sudo tlctl load show agent.example.com
DETAILS FOR AGENT "agent1.example.com"
--------------------------------------
       Number of users: 11
Memory (used RAM+Swap): 14%
      RAM (used/total): 0.5/1.8 GiB
     Swap (used/total): 0.0/1.6 GiB
          Load (1 min): 0.0
        Number of CPUs: 2
                   CPU: 0%
              Bogomips: 11999.98
                Rating: 10.85
        Penalty points: 0
          Last updated: 24 s ago