LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 06-24-2019, 09:29 AM   #1
Geist
Member
 
Registered: Jul 2013
Distribution: Slackware 14 / current
Posts: 442

Rep: Reputation: 196Reputation: 196
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.

Last edited by Geist; 06-24-2019 at 09:35 AM.
 
Old 06-24-2019, 09:52 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Geist View Post
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.
 
Old 06-24-2019, 10:10 AM   #3
Geist
Member
 
Registered: Jul 2013
Distribution: Slackware 14 / current
Posts: 442

Original Poster
Rep: Reputation: 196Reputation: 196
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.
 
Old 06-24-2019, 10:32 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by Geist View Post
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.
 
Old 06-24-2019, 05:10 PM   #5
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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 View Post
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).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Weather App catering for IRISH weather? business_kid Linux - General 30 10-26-2017 02:25 PM
[SOLVED] gnome shell weather extension no longer loads, says 'loading current weather' sdowney717 Linux - Software 3 10-16-2015 12:23 PM
LXer: Weather Trek - Weather planning for Trips LXer Syndicated Linux News 0 01-07-2015 12:21 PM
[SOLVED] awk: same test on same file by different scripts gives different result porphyry5 Programming 1 09-30-2012 05:26 AM
[SOLVED] MySQL make a row first in result of query Skyer Programming 2 08-12-2011 06:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration