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) ?
$HOME
is a variable set for each single user... it is not global. What do you really want: to run as if the user x is logged or only to run from that user home? It's different... Ps> welcome (out) on SuperUsersu
and becoming the user you want to be executing that script?~/.config/autostart
and it does not launch at log in either. Tried mannualy to do:$ IFS== read var query <<< `cat .config/autostart/screenlogger.desktop | grep Exec`
$query
And works fine. Didn't find anything about~/.autostart/
.