Startup Tag^Routine property for UnknownUser

Solapas principales

Hello community!

I am trying to set up Startup Tag^Routine field for the UnknownUser as follows:

And my simple routine is the next:

Calling do ZitRoStart^ZitRo in the terminal prints "Hello", but when opening Caché Terminal it results with the next:

And the terminal closes.

// Cache for Windows (x86-64) 2016.2 (Build 636U) Wed Apr 13 2016 20:58:35 EDT

What am I doing wrong in setup?

Thank you very much!

Respuestas

I think this is the expected/designed behavior - when you log in as that user, that routine runs rather than giving you the typical terminal prompt. When the routine quits/ends, so does the terminal session.

Wow, thanks, I thought that this routine will just be executed before the terminal session start and then the normal terminal session will happen.

Do you know is it possible to achieve this behavior? Thank you!

LOGIN^%ZSTART could do the trick. See the documentation.

For example, put this in %ZSTART.mac:

    Quit

LOGIN
    Do ^%CD
    Quit

Then, when you log in to terminal, you'll get:

Username: tleavitt
Password: ***
Namespace: ?
 
    '?' for help.
    '@' (at-sign) to edit the default, the last namespace
        name attempted.  Edit the line just as if it were
        a line of code.
    <RETURN> will leave you in the current namespace.
Here are the defined namespaces:
     %SYS

     ...
Namespace: USER
You're in namespace USER
Default directory is c:\intersystems\ensemble2\mgr\user\
USER>

If you wanted to make this a per-user setting, it'd take a bit more work, but would certainly be possible.

Nikita

The following example will cause your process to drop into programmer mode if it is set as the user's startup routine:

ZitRoStart
  write "hello", !
  do ^%SYS.PMODE

When a routine is specified as the user's startup routine the process starts in "application mode", sometimes referred to as a tied routine.  Calling routine %SYS.PMODE forces the process into programmer mode if it was started in application mode.

George

George James Software
www.georgejames.com

Hi Nikita,

especially on a 'development mode' installation you need to be careful with messing with UnknownUser. UnknownUser is being used for many different things, and setting a startup routine like this would for example lock you out of the Management Portal. This is because in the default installation the CSP Gateway is using the UnknownUser to log into the instance. So you would have to set it up to use CSPSystem instead.  George has already pointed out how to get the user into programmer mode after running any of your code. The more supported approach is what Tim told you.

Cheers,

Fab

Hi all,
Setting a startup routine like this can't lock non-terminal based Cache functionality (CSP, etc) as the routine is started on terminal kind of logins only, while I agree that LOGIN^%ZSTART should be sufficient in most cases. IMHO, this per user settings of startup routine in SMP comes from "the good old days" of terminal oriented apps which were often tied to terminals to prevent end users from entering MUMPS commands.
=
Cheers,
Alex