run bash script every time user unlocks the screen

112 views Asked by At

With every screen unlock by providing credentials in, my aim is to have a popup for the user to click "agree" for terms & conditions.

I am using xmessage for this, simple bash script that throws the file out and two buttons: -agree; -no;

I can't seem to find a way of this xmessage popup showing up every time user logs into their machine.

This is for AWS WorkSpaces Linux 2 - which runs MATE2.

I have build a script, sample.sh and dropped in the following:

  • profile.d -> this is showing the popup from the script every time a new shell is started which means when launching terminal, this is also launching.
  • init.d -> this is not working
  • /etc/skel/ -> this doesn't seem to work either, even using the .desktop extension with +x and 755.

This is the xmessage code:

  answer=$(xmessage -button ok -center file - "THIS IS A SAMPLE TEST -buttons yes,no -print)
  if [ $answer = "no" ]
  then
         mate-session-save --force-logout
  fi
0

There are 0 answers