Centos End Session Behavior the same as RHEL?

Issues related to applications and software problems
User avatar
rharker
Posts: 23
Joined: 2018/03/23 14:51:02
Location: Gainesville - Florida - USA
Contact:

Centos End Session Behavior the same as RHEL?

Post by rharker » 2018/03/23 15:08:57

I have a script that is running in the background for accounting purposes on instrument hosts in a laboratory environment. My script runs on RHEL 6.9 properly and generates a login timestamp and a logout timestamp lines of text in an accounting text file. It uses /etc/gdm/PreSession/default , /etc/gdm/PostSession/default & /etc/gdm/PostLogin/default which have been modified for our uses. However when installed on a Centos 7 platform it fails to generate the end session logout accounting entry. It is falling through to exit 0 without appending the 2nd line of data.

Code: Select all

# Find out if we're beginning or ending a session
if { [string match "$argv" "end_session"] } {
    if { ![file writable $Log] } {
    onErrorNotify "4 LOG"
    }
    set ifd [open $Log a]
    puts $ifd "[clock format [clock seconds]]\t$Instrument\t$LogName\t$GroupName"
    close $ifd
    unset ifd
    exit 0
} elseif { [string match "$argv" "begin_session"] == 0 } {
    puts stderr "GOTS was called incorrectly!!"
    exit -1
} 

This is the portion of the script that generates the 2nd accounting time stamp entry. Is the end session behaviour the same between RHEL and Centos. Does it create a flag that is formatted as "end_session"?

This is a VIP priority for us and we are dead in the water for 2 of our 6 instruments.

Thanks
Robert Harker
Engineer
University of Florida
Dept.Chemistry
Nuclear Magnetic Resonance Labs
Gainesville, Fl 32611-7200

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: Centos End Session Behavior the same as RHEL?

Post by avij » 2018/03/23 15:41:05

I don't know about your script, but CentOS and RHEL do behave the same way if the versions are the same. You are comparing the behaviour of RHEL 6.9 and CentOS 7. Perhaps you should test this on CentOS 6.9 for a closer match. 6.x and 7.x are significantly different.

User avatar
rharker
Posts: 23
Joined: 2018/03/23 14:51:02
Location: Gainesville - Florida - USA
Contact:

Re: Centos End Session Behavior the same as RHEL?

Post by rharker » 2018/03/23 16:07:08

Thanks - Apparently our script uses "end_session" on logout and we were thinking that Centos might have changed this exit signal to something else like:"End_session","end session", "End Session" and etc. if they did change it we would have to modify our script slightly.

We are not at liberty to change our OS from Centos 7 since the platform supports scientific instruments whose software is installed specifically for this build.

Do you know what the exit signal is for system logoff?
Robert Harker
Engineer
University of Florida
Dept.Chemistry
Nuclear Magnetic Resonance Labs
Gainesville, Fl 32611-7200

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Centos End Session Behavior the same as RHEL?

Post by TrevorH » 2018/03/23 16:08:45

Why not just add some code to that to log what arguments it is called with and then you'll know.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
rharker
Posts: 23
Joined: 2018/03/23 14:51:02
Location: Gainesville - Florida - USA
Contact:

Re: Centos End Session Behavior the same as RHEL?

Post by rharker » 2018/03/27 18:21:38

We are a little lost when it comes to this. Also our script is generating the following error in the postsession.log file:

Application initialization failed: couldn't connect to display ":1"

Any ideas?
Robert Harker
Engineer
University of Florida
Dept.Chemistry
Nuclear Magnetic Resonance Labs
Gainesville, Fl 32611-7200

pjsr2
Posts: 614
Joined: 2014/03/27 20:11:07

Re: Centos End Session Behavior the same as RHEL?

Post by pjsr2 » 2018/03/28 12:33:25

Your application attempts to display something on the desktop ( :1 ) and this desktop doesn't exist (anymore).
I assume it is the onErrorNotify that is to blame.

User avatar
rharker
Posts: 23
Joined: 2018/03/23 14:51:02
Location: Gainesville - Florida - USA
Contact:

Re: Centos End Session Behavior the same as RHEL?

Post by rharker » 2018/03/28 12:52:40

The application initialization failed error is a red herring.

For some reason the PostSession scripts are not running. When we issue ./gots end_session on the command line the end session behaviour is correct. For some reason Centos is not allowing our /etc/gdm/PostSession/default scripts to run:

Is there a bug regarding PostSession execution???
Robert Harker
Engineer
University of Florida
Dept.Chemistry
Nuclear Magnetic Resonance Labs
Gainesville, Fl 32611-7200

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Centos End Session Behavior the same as RHEL?

Post by TrevorH » 2018/03/28 13:11:57

Tested here and it works for me. First, your script needs to be called /etc/gdm/PostSession/Default not 'default'. Next, what is the output from ls -laZ /etc/gdm/PostSession/ ?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
rharker
Posts: 23
Joined: 2018/03/23 14:51:02
Location: Gainesville - Florida - USA
Contact:

Re: Centos End Session Behavior the same as RHEL?

Post by rharker » 2018/03/28 15:23:10

I had a sp error on default in the reply but it is spelled correctly in our systems.

[nmrsu@b400 ~]$ ls -laZ /etc/gdm/PostSession/
drwxr-xr-x. root root system_u:object_r:bin_t:s0 .
drwxr-xr-x. root root system_u:object_r:xdm_etc_t:s0 ..
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 Default
-rwxr-xr-x. root root system_u:object_r:bin_t:s0 Default.1521566517
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0 Default.1521729719
[nmrsu@b400 ~]$
Robert Harker
Engineer
University of Florida
Dept.Chemistry
Nuclear Magnetic Resonance Labs
Gainesville, Fl 32611-7200

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Centos End Session Behavior the same as RHEL?

Post by TrevorH » 2018/03/28 16:06:54

The context on that file looks correct to me but you could try restorecon -RFv /etc/gdm/PostSession and see if that helps. Is there any output with the ~correct timestamp on it in the output from aureport -a ?

I tested by editing /etc/gdm/PostSession/Default and putting this in there:

Code: Select all

#!/bin/sh

/bin/env >> /tmp/gdmpostsess.log
exit 0
If the file is being invoked and is executing then you should end up with a dump of the process's environment in that file.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply