Article 164112 of comp.os.vms:
Guag <guag@PCUCP4.CRA.ENEL.IT> writes:
> I have a system ( VAX station 4090 VMS 6.1 ) that must restart
> automatically the appilcation that is running also after a black out.
> Infact, in case of a black -out the system, after automatic the boot,
> should to login in to a username  automatically.
> Someone knows how to configure DECW$STARTUP to perform this autologin?

I have a command file (below) that automatically logs in SYSTEM
(note that it has  "$ submit ... /user=SYSTEM" at one place).
I think (not going to test it myself) that it could "log in" 
other users, if you give it another value for /user, and not 
require them to have unusual privileges (except for being able 
to execute a _batch_ job within the queue mentioned.

The command file (called SYS-SESSION.COM here) is "declared" 
to the DECW-Startup by having (at least) the following line 
in SYS$MANAGER:DECW$PRIVATE_APPS_SETUP.COM :

	$ DECW$MAINAPP == "@SYS$MANAGER:SYS-SESSION.COM"

Normally, DECW$MAINAPP is the "login-box", so if things go wrong,
you're left without one ("goto default" tries to catch some error
situations foreseen by me). Be careful, and make sure you have
an alternate way (network or terminal) to get into the system.

Wolfgang J. Moeller, Tel. +49 551 2011516 or -510, moeller@gwdvms.dnet.gwdg.de
GWDG, D-37077 Goettingen, F.R.Germany   |       Disclaimer: No claim intended!
<moeller@decus.decus.de>  ----- <moeller@gwdg.de>  -----  <w.moeller@ieee.org>

----- SYS-SESSION.COM ----------------------------------------------------------
$! replacement for DECW$MAINAPP ... (DECW/Motif 1.2)
$!	- to be invoked from within DECW*STARTAPP*.COM
$!	- go batch in oder to force user=SYSTEM
$!	  (requires a certain batch queue - below - and suitable queue state)
$!	- when running in batch, go detached and finally
$!	  run DECW$SESSION - w/o executing DECW$*LOGIN.COM
$!
$!	Requires all sorts of suitable privileges!
$!
$! w.j.m. jul 1994, somewhat after (DECW/Motif 1.2) DECW$STARTSM.COM
$!==============================================================================
$!
$ on warning then goto default
$!
$ if f$environ("depth").eq.0 then goto 'f$mode()'	! initially depth > 0
$!
$!
$!*****	1st step: invoked from e.g. DECW*STARTAPP, DECW$DISPLAY=>display
$!
$ queue = "GWD$SYS_JOBS"	! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$!
$ if f$getqui("display_queue","queue_batch",queue) then goto tq1
$ goto default
$tq1:
$ if f$getqui("display_queue","queue_idle",queue) .or.-
     (f$getqui("display_queue","queue_available",queue) .and.-
      .not.f$getqui("display_queue","queue_stop_pending",queue)) then goto tq2
$ goto default
$tq2:
$ display = f$getdvi("DECW$DISPLAY","fulldevnam")
$ if display.nes.""
$ then
$	submit/queue='queue'/user=SYSTEM/nolog -
		'f$environ("procedure")' -
		/parameter=('display')
$	exit
$ endif
$! 
$default:
$ set noon
$ run SYS$SYSTEM:DECW$STARTLOGIN
$ exit
$!
$!
$!*****	2nd step (normally BATCH), P1=display
$!
$NETWORK:
$INTERACTIVE:
$BATCH:
$ on warning then exit $status
$!
$ display = f$getdvi(p1,"fulldevnam")
$ if f$extract(0,4,display).nes."_WSA" then exit 2
$!
$ myself = f$environ("procedure")
$ myname = f$parse(myself,,,"name")
$ run/detached SYS$SYSTEM:LOGINOUT	-
	/authorize	-		! required for getting SYS$LOGIN etc.
	/process_name='myname'	-
	/input='myself'		-
	/output='display'	-	! pass WSA as SYS$OUTPUT
	/error='myname'.LOG
$ exit
$!
$!
$!*****	3rd step (detached), SYS$OUTPUT=>display
$!
$OTHER:
$ set noon
$ display = f$getdvi("SYS$OUTPUT","fulldevnam")
$ if f$extract(0,4,display).nes."_WSA" then exit 2
$ define/job DECW$DISPLAY 'display'
$!
$! ... leave SYS$OUTPUT pointing to _WSA ...
$!
$ define/nolog decw$doing_session SESSIONINIT
$ sessioninit = F$TRNLNM("DECW$SESSIONINIT")
$ if sessioninit .EQS. "" then goto do_sessionmain
$ 'sessioninit
$do_sessionmain:
$ define/nolog decw$doing_session SESSIONMAIN
$ sessionmain = F$TRNLNM("DECW$SESSIONMAIN")
$ if sessionmain .EQS. "" then goto do_sessionend
$ 'sessionmain
$do_sessionend:
$ define/nolog decw$doing_session SESSIONEND
$ sessionend = F$TRNLNM("DECW$SESSIONEND")
$ if sessionend .EQS. "" then goto do_exit
$ 'sessionend
$do_exit:
$ logout
$ stop/id=0
----- SYS-SESSION.COM ----------------------------------------------------------

Wolfgang J. Moeller, Tel. +49 551 2011516 or -510, moeller@gwdvms.dnet.gwdg.de
GWDG, D-37077 Goettingen, F.R.Germany   |       Disclaimer: No claim intended!
<moeller@decus.decus.de>  ----- <moeller@gwdg.de>  -----  <w.moeller@ieee.org>


