cron - Using Zenity in a root incron job to display message to currently logged in user -


working on script auto-upload files placed in directory, , display link them logged in user. users of machine authenticated via ldap.

the directory being watched incron outside of of users' directories, , symlinked /home/username/uploads directory each user. when user places file here, automatically uploads without issue.

where run problems displaying file url current user. here's relevant code:

from /var/spool/incron/root

/home/public/uploads in_close_write /home/public/upload_files.sh > /dev/null 2>&1 

lines /home/public/upload_files.sh pertaining zenity display:

display="$(ck-list-sessions | grep "active = true" -a1 | tail -n 1 | cut -f2 -d"'").0" zenity --info --text="http://aniceurlhere.com/`date +%m.%d.%y`/$filename" --display=$display 

as mentioned, upload completes, zenity message never displayed. looking through /var/log/cron, can see job run , complete, , no errors shown there.

any assistance appreciated.

this takes bit of effort if want use zenity or notify-send. didn't working yet used xmessage instead:

easy option 1: xmessage (in script)

mssg="/tmp/mssg-file-${random}"  echo -e " message \n ==========\n done task, yey. " > ${mssg} xmessage -center -file ${mssg} -display :0.0  [[ -s ${mssg} ]] && rm -f ${mssg} 

easy option 2: set display (then should work)

    export display=:0 && /usr/bin/somedirectory/somecommand 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -