You are not logged in.

#1 2023-04-02 19:54:49

CaeriTech
Member
Registered: 2021-07-12
Posts: 19

Immediate conky display of downloaded data

I've been looking for a solution that could be implemented entirely in the data download script and/or the conky config (and did not require a cron job) that would have  downloaded data available for conky when I first log into my desktop and promptly displayed thereafter.

So I call the download script BEFORE I call conky in my conky config like so:

${execi 2100 /path_to_script_that_downloads_data && conky --config=/path_to_conky_config}

And in my window manager like so:

/path_to_script_that_downloads_data && conky --config=/path_to_conky_config

But the download script is run again as soon as conky starts. So to prevent this when I log into my desktop I also add the code below to the very top of the download script so that if the data file is less that 2 minutes old I do not run the download script again until the next scheduled interval. A two minute limit seems adequate unless you have a massive amount of processing to extract the data.

Further runs of the download script will occur at the scheduled interval and not be affected by this.

data__REFRESH="2"
if [[ -f /path_to_downloaded_data_file ]] && [[ $(find  /path_to_downloaded_data_file -mmin +${data__REFRESH}) == "" ]] ; then
   echo "downloaded data is less than ${data__REFRESH} minutes old.  ignoring"
   #
   # or add send-notify, aplay, flite or any other preferred notification that the update is being ignored
   #
   exit
fi

To further keep everything is sync I schedule the conky refresh 30 seconds after the 2100 seconds for the download script run.

${execpi 2130 grep --extended-regexp 'whatever you want conky to display' /path_to_downloaded_data_file}

So now I never have an empty conky when I log into my desktop for the first time and the conky will display the data 30 seconds after it has been downloaded.


-=[ LIVE enabled UEFI with redundant syslinux pure systemd detached LUKS header partitionless encrypted GPT SSDx3 RAID0 wayland only because I can.  ]=-
    Backward compatibility is for the masses. There's no dual-boot here.

    [CaeriTech remains only artificially intelligent.  Turing would be aghast at just how artificial.]

Offline

Board footer

Powered by FluxBB