I would like to run something like that on loggin in:
Logging lock-screen events
I then tried to use both systemd and upstart described in this answer: https://askubuntu.com/questions/228304/how-do-i-run-a-script-at-start-up#answer-228313
However my script is never launched on start up.
The script run fine if I launch it myself once logged in.
The script I placed to /etc/init.d/ looks like :
#!/bin/bash
### BEGIN INIT INFO
# Provides: screenlogger
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: screenlogger
# Description: screenlogger
### END INIT INFO
export SCREENLOGGER="$HOME/.bin/screenlogger.sh"
if [ -e "$SCREENLOGGER" ]
then
$SCREENLOGGER
fi
Then I realised that if I just put a echo "$HOME" >> /home/myloggin/test the file will allways be empty on reboot.
Also, it seems that the script is runned at boot and not on log in and the user is root not myself.
So I would like to know if that is possible to run a script on log in as the user process owner (with $HOME fullfilled) ?