Use Token for legacy CLI access

  • 1 March 2022
  • 0 replies
  • 536 views

Userlevel 2
Badge +3

This is simple but working trick to maintain Commvault.

When you want to start (typically backup) jobs via CLI instead of Schedule Policies, it involves qlogin in the first place to log into CommCell.

This command is mostly straight-forward to use but when trying to invoke multiple jobs from one server it arises some errors, like Error 0x10b: User not logged inError 0x208 Token file is corrupted or relevalt errors.

As BOL explains -f parameter to use Token file as follows:

When using qlogin without -f option, it generates a file named "qsessions.OS-User, directly under Commvault installation directory.
This file must be created with administrative privilege on this server to modify installation directory, also need to exist until any qoperations called in the shell (like qlist job), then it will be removed when the shell calls qlogout.
This default token file is generated per OS user, not Commvault user so if multiple shells are called simultaneously it uses the same qsession file.

So when the same OS user, typically dedicated batch user without administrative privilege on this server, multiple issues happen:

  • qlogin fails to generate qsessions file in the first place.
  • calling multiple qlogin causes multiple overwrite of this qsessions file, possibly leading the corruption of this file itself.
  • when one script completed and call qlogout, another scripts would fail since the first one forcefully logout the session.

To avoid this situation, you can prepare multiple OS users to invoke each CLI scripts with administrative privilege, but more better approach is to utilize Token file with -f parameter.
This allows you to generate Token file per each CLI script, regardless the OS user who invokes the scripts, without administrative privilege.

So modify qlogin with -f, append -tf tokenfile at each qcommands/qoperations should do the trick.

Hope this helps,


If you have a question or comment, please create a topic