i got this error message whenever I tried to call zenity in a cron job of a user. I found some hints in the net but still failed. But's its just 2 commands you have to add.

 

 

Add in .bashrc

[[ $DISPLAY ]] && xhost +localhost

Now add following line in the code calling Zenity

DISPLAY=':0.0'

(
  echo "# Backing up user data ..."
  sudo rsnapshot daily
) | DISPLAY=':0.0' zenity --title="Backup running - do not close lid or shut down system" --progress --pulsate --auto-close --width=800 &

Add comment

Note

Spam comments are purged and not published. Review is done manually and therefore it usually takes between some hours and one day until a comment will be published.