Where/how to save result of weather query once to make available to different scripts?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Where/how to save result of weather query once to make available to different scripts?
Is this a job for named pipes? Or something else? Something better?
Pull result every 5 minutes, save it somewhere, scripts can slurp it up and do whatever with them.
P.S.: After reading the "what are your deeds" post, I have to say: I have done nothing so far, except think about named pipes and saving the result in a file.
I'm interested in the, uh, efficacy of uh...solutions, I guess. Like, maybe this can be saved to memory instead of the disk, but I don't know if there's a place for that already or if I would have to mount a ram disk and put a file there, etc.
I guess I just want to know what you, astute linuxer with all those cool tricks up your sleeve, would do to make a "variable" like value available to the system in general, or something.
Is this a job for named pipes? Or something else? Something better?
Pull result every 5 minutes, save it somewhere, scripts can slurp it up and do whatever with them.
P.S.: After reading the "what are your deeds" post, I have to say: I have done nothing so far, except think about named pipes and saving the result in a file. I'm interested in the, uh, efficacy of uh...solutions, I guess. Like, maybe this can be saved to memory instead of the disk, but I don't know if there's a place for that already or if I would have to mount a ram disk and put a file there, etc. I guess I just want to know what you, astute linuxer with all those cool tricks up your sleeve, would do to make a "variable" like value available to the system in general, or something.
Not enough details to venture a guess. You don't say what the goal of this is, what language, etc.
If the program is going to run constantly until you kill it, then saving this in a variable/array/whatever might be ok. Again, you don't say how many places you want to save what data for, so hard to guess. Otherwise, saving the data to a temp file for reading may be OK as well...but again, lack of any details about the goal/language makes it almost impossible to guess at.
Ah, sorry if I was too obtuse, I basically mean a file, I guess, with language being secondary. It's hard to formulate this without keeping it an open question, imho.
Maybe "a simple string" is okay? Like in an environment variable.
Think cronjob, it queries a weather station (or if it makes the problem easier, retrieves a string from a server) and writes the result to [best solution for this].
Then, think conky scripts, temperature conversion scripts/tools, pretty printers, automatic house temperature control, automated weapon turrets, rabbit hutch climate control, releasing of dogs that herd cattle into cooler or warmer spots, combat trained bees, etc, using each their own programing language/interface, but they all have a means to read a string from a linux system.
So, no matter the language, instead of having to need a "query a weather server capability" in all those scripts, have one single script that can do it, and turn it into an offline result for other things that can read and process simple strings.
Which solution would be good for that?
Named pipes? Something like "urandom" which seems to be some sort of data generator that acts like a file, etc.
Lol. Sorry if this is a silly thing. I'm probably overhtinking it, and should just slap it into a file, but then...where to put that file? Who should own it? Etc. Lol.
Anyway, despite my possibly too flippant description, I am interested in this. Genuinely.
Ah, sorry if I was too obtuse, I basically mean a file, I guess, with language being secondary. It's hard to formulate this without keeping it an open question, imho. Maybe "a simple string" is okay? Like in an environment variable.
Think cronjob, it queries a weather station (or if it makes the problem easier, retrieves a string from a server) and writes the result to [best solution for this].
Then, think conky scripts, temperature conversion scripts/tools, pretty printers, automatic house temperature control, automated weapon turrets, rabbit hutch climate control, releasing of dogs that herd cattle into cooler or warmer spots, combat trained bees, etc, using each their own programing language/interface, but they all have a means to read a string from a linux system.
So, no matter the language, instead of having to need a "query a weather server capability" in all those scripts, have one single script that can do it, and turn it into an offline result for other things that can read and process simple strings.
Which solution would be good for that? Named pipes? Something like "urandom" which seems to be some sort of data generator that acts like a file, etc.
Lol. Sorry if this is a silly thing. I'm probably overhtinking it, and should just slap it into a file, but then...where to put that file? Who should own it? Etc. Lol.
Anyway, despite my possibly too flippant description, I am interested in this. Genuinely.
Sorry, still no details. Again, you're leaving out the actual goal of this, language(s) you're going to use, how much data you're talking about, program run time/termination, etc.
A program that does continuous processing and is always in memory, and keeping a few pieces of weather data for one city? As said before, keeping that in memory is easily done. A program that runs every now and then terminates is very obviously going to release all the memory, so you'll have to save to a file. Where you put the file, what you name it, etc., is up to you. This is YOUR program. And the language DOES matter, since there are some that parse and handle things like this much easier than others.
And any weather-related program shouldn't refresh every five minutes, simply because weather sites don't update that often.
Geist, you have an interesting, avantgarde style.
I fear it will serve you very little when working with computers; they are very unimaginative and notoriously nitpicking.
But to answer your question:
Quote:
Originally Posted by Geist
I guess I just want to know what you, astute linuxer with all those cool tricks up your sleeve, would do to make a "variable" like value available to the system in general, or something.
Who me? Flattered. Well since you insist, said the aging Diva, here's my take:
Environment variable (tricky) or temporary file in /tmp or /dev/shm (one of those should be available on your system as part of the RAM mounted into the filesystem).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.