This section covers:
Setting environment variables
Using display-dependent sessions
Running scripts at login
Recovering a back-up session
For example, if you create an executable ksh script, /etc/dt/config/Xsession.d/myvars, containing:
then the variable
will be set in each user's environment at the next login.
sets the variable
in each user's environment at the next login.
Session Manager does not automatically read the .profile or .login file. However, it can be configured to use these files; see Optionally Sourcing the .profile or .login Script.
For example, if in /etc/dt/config/C/sys.resources you specify:
To set personal resources, add the resources to the file HomeDirectory/.Xdefaults.
You can set display-specific resources for all desktop users on the system. Also, users can set display-specific resources limited to their own session. This enables you to specify resources depending upon which display the user uses to log in to the desktop.
To set display-specific resources for all desktop users on the system, create the file /etc/dt/config/language/sys.resources that specifies the display-specific resources.
To set personal display-specific resources, specify the resource in HomeDirectory/.Xdefaults.
You delimit these resources by enclosing them in cpp
conditional statements. A
macro is defined depending upon the value of the
$DISPLAY variable. This is done by converting all . (period)
and : (colon) characters to _ (underscores), stripping off any screen specification,
and finally prefixing
DISPLAY_ to the
For example, a
$DISPLAY of :0 would be
$DISPLAY of blanco.gato.com:0.0 would be DISPLAY_blanco_gato_com_0. The resulting
value can be used as part of a cpp test in a session resource
file. For example, if in /etc/dt/config/C/sys.resources
#ifdef DISPLAY_blanco_gato_com_0 Myapp*resource: specialvalue1 #endif
#ifdef DISPLAY_pablo_gato_com_0 Myapp*resource: specialvalue2 #endif
the resource MyApp*resource will be set in
RESOURCE_MANAGER to specialvalue1 when the user logs in on display blanco.gato.com:0; specialvalue2 when the user logs in on pablo.gato.com:0; and value when the user logs in on another display.
You can specify alternate applications to start as part of a user's initial session.
Copy /usr/dt/config/language/sys.session to /etc/dt/config/language/sys.session.
Each entry in sys.session appears as:
To start an additional application as part of a user's initial session, specify a new sys.session entry with a full path name. For example, to start /usr/bin/X11/xclock as part of a user's initial session, add an xclock entry to /etc/dt/config/C/sys.session:
# # Start up xclock... # dtsmcmd -cmd "/usr/bin/X11/xclock -digital"
A user can set up a display-specific session to tune a session to a particular display.
For example, to create a display-specific session for display pablo.gato.com:0:
cp -r HomeDirectory/.dt/sessions HomeDirectory/.dt/pablo:0
When the user next logs in on display pablo.gato.com:0, the Session Manager will start that display-specific session.
Users can specify that additional commands be started when they log in to their desktop sessions. This is useful for setting up X settings that are not saved by Session Manager. For example, the user can use xsetroot to customize the root (workspace) pointer. Another use would be to start applications that are unable to be saved and restored by Session Manager. If an application will not restart when the session is restored, the user can start the client using this method.
Generally this file is a script and must have execute permission. Processes started in sessionetc should be run in the background.
Do not use sessionetc to start clients that are automatically restored by Session Manager. Doing so can cause multiple copies of the application to be started. You may not be able to see the copies immediately because the windows may be stacked on top of one another.
Create the file HomeDirectory/.dt/sessions/sessionexit containing the commands.
Like sessionetc, this file is usually a script with execute permission.
When Session Manager saves a session, the session information is stored in the HomeDirectory/.dt/sessions directory or in the HomeDirectory/.dt/display directory if using a display-specific session. In these directories, Session Manager creates a subdirectory named current or home to store information for the respective current or home session. Before the session information is stored, Session Manager makes a backup of the prior session with that name and stores it in current.old or home.old.
Log in using the Failsafe Session or Command Line Login from the login screen.
Copy the backup session directory to the active name. For example, to recover the backup home session:
cp -r HomeDirectory/.dt/sessions/home.old \ HomeDirectory/.dt/sessions/home
Display-specific sessions can be recovered in the same manner.
Session Manager logs each user's session startup progress in this file.