From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX"  3-JUN-1992 20:13:33.10
To:	"INFO-VAX@sri.com"@BCSAIC
CC:	M.D.Clay@CRVAX.SRI.COM
Subj:	Re: How to restart the DECwindows session manager

DECW$Gurus,

Awhile back I posted a command procedure for restarting the DECwindows session
manager which had the teensy little problem that when the user eventually
logged out, the login box would not come up.

Joe Meadows and I sat down for a couple of hours and found the problem with
the original procedure.  The trick was to find a WSAn: device that would not
go away when the session manager exited and to assign the session manager's
SYS$OUTPUT and SYS$ERROR streams to this device before starting the new 
session manager.  Included below is the finished procedure.  Enjoy.

Cheers,
	Michael Clay
	Boeing Computer Services
	Internet: claym@bcsaic.boeing.com
	Mom Bell: (206) 952-0504


$!+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$! 
$! FACILITY:
$!    
$!    DECWINDOWS - START_SESSION.COM
$!    
$! 
$! ABSTRACT:
$!    
$!    This procedure is used to start a new session manager after a faulty 
$!    user or faulty application program has blown away the session manager.
$!    
$! 
$! USAGE:
$!    
$!    $ @START_SESSION         ! Start new session manager for yourself
$!    
$!    $ SUBMIT START_SESSION - ! Start new session manager
$!        /USER=user-name    - ! for another user (requires CMKRNL privilege)
$!        /QUEUE=queue-name    ! on another cluster node
$!    
$! 
$! HISTORY:
$!    
$!    13-MAR-1992  MDC  Original version by M.D.Clay
$!    
$!    26-MAY-1992  JEM  J.E.Meadows fixed problem with login box not appearing 
$!                      after the user had quit a session whose session manager 
$!                      had been restarted using this procedure.
$!   
$!-----------------------------------------------------------------------------
$! 
$  DETACH = "RUN SYS$SYSTEM:LOGINOUT.EXE/DETACHED/AUTHORIZE/TIME_LIMIT=0/INPUT="
$! 
$  MODE =  F$MODE()
$  IF MODE .EQS. "OTHER"
$  THEN
$     !
$     ! Running in detached process.  Start session manager now...
$     ! 
$     USERNAME =  F$GETJPI( 0 , "USERNAME" )
$     SET NOON
$     SET PROCESS/NAME='USERNAME'
$     RUN SYS$SYSTEM:DECW$SESSION.EXE
$     LOGOUT
$  ELSE
$     ! 
$     ! Running interactive or batch.  Rerun self in detached process.
$     ! 
$     PROCEDURE =  F$ELEMENT( 0 , ";" , F$ENVIRONMENT( "PROCEDURE" ) )
$     DECW$DISPLAY =  F$DEVICE( "_WSA*:" )   ! Ignore _WSA0: template device
$     DECW$DISPLAY =  F$DEVICE( "_WSA*:" )   ! Use first ``real'' _WSAx: device
$     DETACH 'PROCEDURE' -
         /OUTPUT = 'DECW$DISPLAY' -
         /ERROR  = 'DECW$DISPLAY'
$  ENDIF
$  EXIT


