[NEWSboard IBMi Forum]
  1. #1
    Registriert seit
    Dec 2004
    Beiträge
    178

    User vor Sicherung prüfen

    Guten Morgen,

    ich möchte jede Nacht bestimmte Userlibs,DLO und IFS sichern.

    Bis jetzt habe ich das immer über die Konsole gemacht und vorher alle vorher SBS runtergefahren.

    Meine Frage: Kann ich vorher prüfen ob noch USER auf der Maschine eingeloggt sind, bzw. Bibliotheken loggen ? und dann diese mit einem CL beenden ??

    Ich bekomme nämlich langsam ein Zeitproblem das die Sicherung und der mein Abschluss von WAWI morgens fertig wird. Ein SAVSYS mach ich dann immer Samstags.

    Der Abschluss von der WAWI kann auch nur laufen wenn niemand in der WAWI eingeloggt ist.

    Habt Ihr da was für mich ??

    Gruß

    Christian

  2. #2
    Registriert seit
    May 2002
    Beiträge
    2.642

    Check User

    Hallo Christian,
    vielleicht hilft Dir dies schon weiter:
    How to Check Whether a User Is Signed On
    by Scott Klement
    Club Tech iSeries Programming Tips Editor

    October 09, 2005 — *
    Q: To report an error condition, I'd like to write a program that sends a user a message. If the user is signed on, I'd like to send a message to that user's message queue. If the user isn't signed on, I'd rather send an e-mail to the user's pager. How can I tell whether the user is signed on?
    A: To determine whether a user is signed on, use the List Signed-On Users (QEZLSGNU) API. This API lists the terminals that a user is signed on to, and it excludes batch jobs. If the user is signed on to no terminals, you know to use e-mail. If some terminals are listed, you can send to the user's message queue instead.
    To demonstrate this method, I've written a command called Check User (CHKUSR). This command is intended to be called from a CL program to see whether a user is online. The source for the command object follows:
    CMD PROMPT('Check whether user is online')

    PARM KWD(USERID) TYPE(*NAME) LEN(10) MIN(1) +
    PROMPT('User ID to check')

    PARM KWD(ONLINE) TYPE(*CHAR) LEN(4) RTNVAL(*YES) +
    PROMPT('CL var for user is online') MIN(1)
    This command accepts two parameters. The first one is the user ID that you'd like to check for. The second parameter is returned from the utility and is set to *YES if the user is online and *NO if the user is not online.
    You can use this utility from your CL program as follows:
    PGM

    DCL VAR(&ONLINE) TYPE(*CHAR) LEN(4)

    CHKUSR USERID(BOBK) ONLINE(&ONLINE)

    IF (&ONLINE *EQ '*YES') DO
    SNDMSG MSG('Hey, you! We have a problem!') TOUSR(BOBK)
    ENDDO
    ELSE DO
    SNDDST TYPE(*LMSG) +
    TOINTNET((bobspager@example.com)) +
    DSTD('Problem') +
    LONGMSG('Hey, you! We have a problem!') +
    SUBJECT('Help! Help!')
    ENDDO

    ENDPGM
    To make the CHKUSR command work, I need to write a command processing program (CPP) that can look up the user and report whether he or she is online. This CPP is called CHKUSRR4 and is written in ILE RPG. Here's the code for the CHKUSRR4 program:
    D CHKUSRR4 PR Extpgm('CHKUSRR4')
    D UserID 10A const
    D Online 4A
    D CHKUSRR4 PI
    D UserID 10A const
    D Online 4A

    D QUSCRTUS PR ExtPgm('QUSCRTUS')
    D usrSpc 20A CONST
    D extAttr 10A CONST
    D initSize 10I 0 CONST
    D initValue 1A CONST
    D publicAuth 10A CONST
    D text 50A CONST
    D replace 10A CONST
    D error 32767A options(*varsize)

    D QEZLSGNU pr extPgm('QEZLSGNU')
    D usrSpc 20A const
    D format 8A const
    D user 10A const
    D display 10A const
    D incDiscon 10A const
    D incSignOff 10A const
    D errorCode 32767A options(*varsize)

    D QUSPTRUS pr extPgm('QUSPTRUS')
    D usrSpc 20A const
    D pointer *

    D dsListInfo ds based(p_ListInfo)
    D offset 10I 0 overlay(dsListInfo:125)
    D entry_count 10I 0 overlay(dsListInfo:133)
    D entry_size 10I 0 overlay(dsListInfo:137)

    D ErrorCode ds
    D bytesProv 10i 0 inz(0)
    D bytesAvail 10i 0 inz(0)
    D msgid 7A

    D UsrSpc c 'CHKUSER QTEMP'

    /free

    QUSCRTUS( UsrSpc
    : 'QEZLSGNU'
    : 1024 * 32
    : x'00'
    : '*ALL'
    : *blanks
    : '*YES'
    : ErrorCode );

    QEZLSGNU( UsrSpc
    : 'SGNU0100'
    : UserID
    : '*ALL'
    : '*NO'
    : '*NO'
    : ErrorCode );

    QUSPTRUS( UsrSpc: p_ListInfo);

    if (entry_count > 0);
    Online = '*YES';
    else;
    Online = '*NO';
    endif;

    *inlr = *on;
    /end-free
    This program starts by creating a user space with the Create User Space (QUSCRTUS) API. The user space is needed because that's where the QEZLSGNU API writes its output.
    The QEZLSGNU API is then used to load the list of signed-on users into the user space. In the third parameter, I tell the API which user should be listed. I can also specify which display stations are included, whether disconnected jobs should be included in the list, and whether signed-off users that have spooled files should be included in the list.
    In this situation, I don't care whether the user has spooled files, and I'm not interested in disconnected jobs. I do want to know any place that the user is signed on from, so I specify *ALL for the workstation, *NO for the "include disconnected jobs" parameter, and *NO for the "include signed-off users with spooled files" parameter.
    The QUSPTRUS API is used to get a pointer to the user space so that I can see what's in it. I overlay the start of the user space with the dsListInfo data structure and check to see whether there are any workstations that the user is signed on to.
    If there are any, I return *YES; otherwise, I return *NO.
    To compile this utility, run the following commands:
    CRTBNDRPG PGM(CHKUSRR4) SRCFILE(my-lib/QRPGLESRC)

    CRTCMD CMD(CHKUSR) PGM(CHKUSRR4) SRCFILE(my-lib/QCMDSRC) +
    ALLOW(*IPGM *BPGM)
    You can learn about the QEZLSGNU API at the following link:
    http://publib.boulder.ibm.com/infoce...s/QEZLSGNU.htm

  3. #3
    Registriert seit
    Dec 2004
    Beiträge
    178
    Danke TARASIK !!

    wie verhält sich eigentlich die Sicherung wenn ein PF oder PGM gelockt ist ??

    Übergeht die Sicherung die Datei oder bleibt Sie mit nem MSGW stehen ??

  4. #4
    Registriert seit
    Feb 2001
    Beiträge
    20.241
    Das hängt vom SAVACT ab.
    Siehe hierzu diverse Beiträge im Forum.
    Dienstleistungen? Die gibt es hier: http://www.fuerchau.de
    Das Excel-AddIn: https://www.ftsolutions.de/index.php/downloads
    BI? Da war doch noch was: http://www.ftsolutions.de

  5. #5
    Registriert seit
    Oct 2003
    Beiträge
    192
    Ansonsten gilt...

    Beenden des Subsystems QINTER und alle User sind off *g*

    Gruß
    Rince

  6. #6
    Registriert seit
    Dec 2004
    Beiträge
    178
    @RINCEWIND

    FTP und ODBC gehen dann aber trotzdem wenn QINTER weg ist ??

    Oder seh ich das falsch ??

    Gruß

  7. #7
    Registriert seit
    Feb 2001
    Beiträge
    20.241
    Stimmt.
    Das beendet man mit ENDHOSTSVR, starten mit STRHOSTSVR.
    Dienstleistungen? Die gibt es hier: http://www.fuerchau.de
    Das Excel-AddIn: https://www.ftsolutions.de/index.php/downloads
    BI? Da war doch noch was: http://www.ftsolutions.de

  8. #8
    Registriert seit
    Dec 2004
    Beiträge
    178
    ok. Noch ne frage:

    kann ich das IFS und QDLS mit folgenden Befehl sichern, auch wenn NICHT alle SBS beendet wurden:

    SAVDLO DLO(*ALL) DEV(TAP01) ENDOPT(*LEAVE) +
    OUTPUT(*PRINT) DTACPR(*YES) SAVACT(*YES) +
    SAVACTWAIT(0)

    SAV DEV('/QSYS.LIB/TAP01.DEVD') OBJ(('/*') +
    ('/QSYS.LIB' *OMIT) ('/QDLS' *OMIT) +
    ('/fixes' *OMIT) ('/ptf1' *OMIT)) +
    SAVACT(*YES) OUTPUT(*PRINT) +
    ENDOPT(*UNLOAD) UPDHST(*YES) DTACPR(*YES)

    oder müssen alle SBS weg sein ??
    und was müsste ich bei dem letzten Befehl bei SAVACTOPT eintragen ?? Da steht das man einen Systemwert setzen soll !!

    Gruß

  9. #9
    Registriert seit
    Feb 2001
    Beiträge
    20.241
    SAVACTOPT ???

    Übrigens:
    DTACPR(*YES) sollte entfallen, da die Bandlaufwerke eine eigene Komprimierung haben und durch die Softwarekomprimierung:
    a) die Laufzeit verlängert wird
    b) durch die Bandkomprimierung wieder mehr gesichert wird

    Wenn eine komprimierte Datei nochmals komprimiert wird, kommt es wieder zu einer Verlängerung !
    Das Bandlaufwerk erkennt nicht, dass bereits komprimiert wurde. Ausserdem ist das Bandverfahren häufig effektiver.

    Die Komprimierung im SAVxxx sollte nur bei SAVF's angewendet werden.
    Dienstleistungen? Die gibt es hier: http://www.fuerchau.de
    Das Excel-AddIn: https://www.ftsolutions.de/index.php/downloads
    BI? Da war doch noch was: http://www.ftsolutions.de

  10. #10
    Registriert seit
    Dec 2004
    Beiträge
    178
    ok. danke. schon geändert.

    noch ne letzte frage:

    Kann ich SAVACTWAIT auf 0 stellen oder muss es 1 sein wenn ich die minimale Zeit haben will ??

    Danke für alles !!

    Gruß

    Linguin

  11. #11
    Registriert seit
    Feb 2001
    Beiträge
    20.241
    Ja, da die Wartezeit pro Objekt gilt.
    Kann ein einzelnes Objekt nicht zugeordnet werden, wartet SAV die angegebene Zeit bevor es das nächste Objekt nimmt.

    Bisher konnte ich noch keinen Objekt-Verlust feststellen (also nicht gesichert).

    Große Ausnahmen gibt's jedoch:
    DTAARA's, DTAQ's und noch ein paar Arten können nicht parallel gesichert werden, diese werden dann übersprungen.
    Dienstleistungen? Die gibt es hier: http://www.fuerchau.de
    Das Excel-AddIn: https://www.ftsolutions.de/index.php/downloads
    BI? Da war doch noch was: http://www.ftsolutions.de

Similar Threads

  1. DDMF prüfen
    By Christian.Hesse in forum IBM i Hauptforum
    Antworten: 3
    Letzter Beitrag: 03-01-07, 11:53
  2. User defined function
    By KM in forum IBM i Hauptforum
    Antworten: 2
    Letzter Beitrag: 04-08-06, 10:34
  3. Aktive User ermitteln + Anmeldezeit anzeigen
    By QSECOFR-1 in forum IBM i Hauptforum
    Antworten: 1
    Letzter Beitrag: 03-08-06, 18:06
  4. Anzahl angemeldeter User auf der AS400
    By Bratmaxxe in forum NEWSboard Programmierung
    Antworten: 4
    Letzter Beitrag: 29-06-06, 10:29
  5. Mailadresse von User auf Iseries speichern und auslesen
    By linguin in forum IBM i Hauptforum
    Antworten: 3
    Letzter Beitrag: 22-06-06, 08:39

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • You may not post attachments
  • You may not edit your posts
  •