0

g'day all.. in a spot of bother and a starter of ten for someone. I have placed a simple bash shell script into the root of "/etc/profile.d" and without fail, the script executes 3 times within nanoseconds.

To diagnosis this, made a separate bash shell script within "/etc/profile.d" with the following syntax below, and all three email results are identical.

I can reproduce this anomaly on over 15 identical Oracle OEL 8.7 servers.

I would prefer to avoid modifying /etc/profile or /etc/bashrc for all the obvious reasons.

#!/bin/bash
loginctl show-session "$XDG_SESSION_ID" | mailx -r serveremail@address.com -s "This is a development email" "myemail@address.com" 

Results:

Id=54
User=0
Name=root
Timestamp=Thu 2023-01-05 10:26:51 CST
TimestampMonotonic=613980645805
VTNr=0
TTY=pts/0
Remote=yes
RemoteHost=(IP address removed)
Service=sshd
Scope=session-54.scope
Leader=578034
Audit=54
Type=tty
Class=user
Active=yes
State=active
IdleHint=no
IdleSinceHint=1672936187092136
IdleSinceHintMonotonic=614156116099
LockedHint=no

Parenthetical:

[ Oracle Linux Server 8.7 ]
[ Kernel: 5.15.0-5.76.5.1.el8uek.x86_64 ]

I have entertained a species of lock, however these are executed nanoseconds apart...

I would be massively grateful for any clues, suggestions or solutions.

Cheers in advance!

  • Terribly sorry... Failed to mention that the script is designed to execute when logging into GDM. After successfully logging in, the script executes 3 times. However, when I launch a terminal session, the script executes just the once. – user999317 Jan 05 '23 at 16:55
  • I wouldn’t be surprised that, when logging into GDM , several processes and or shell scripts get started, some of which run with a full shell environment (rather than fully stand alone) and thus sourcing content from profile.d – diya Jan 08 '23 at 16:31

0 Answers0