You are not logged in.
Very nice, @loutch.
I knew you would easily find a image of a wind rose when you have the direction of the wind.
Great use of my old code (to copy images) but that was expected of you.
If you need help when the wind is 0 km/h (CLM), just post the contents of the file ~/Accuweather_conky_script/marens_hourly/wind.
At the moment I don't know in what form it will appear.
That should be tested.
Last edited by marens (2024-07-30 23:12:09)
If people would know how little brain is ruling the world, they would die of fear.
Offline
Offline
I am very sorry that the health problems have returned.
Get well soon @loutch.
If people would know how little brain is ruling the world, they would die of fear.
Offline
I am very sorry that the health problems have returned.
Get well soon @loutch.
Same on my end @loutch, get well soon mate !
My Linux installs are as in my music; it s on Metal
Offline
Hello
I need help to turn this weekly script into a daily one.
#!/bin/bash
## files
LOG="$HOME/.conky/barographe/ListePression.log"
GRAPH="$HOME/.conky/barographe/graph.png"
## Verifier argument
##Infos generales
DATE=$(date +"%s")
DATE1WEEK=$(date --date="1 week ago" +"%s")
# liste des dates de releve du fichier log
EPOCH=()
while read
do
EPOCH+=( "$REPLY" )
done< <(awk '{print $1}' "$LOG")
# si le fichier existe et contient des valeurs de plus d'une semaine (premiere = plus vieille)
#supprimer premiere valeur
[[ -f $LOG ]] && {
for i in $(seq 0 $(($(wc -l < $LOG)-1)))
do
[[ $DATE1WEEK -gt ${EPOCH[$i]} ]] && sed -i '1d' $LOG || break
done
}
## Conversion en hectopascal et soustraction de la pression moyenne pour ramener l'axe a zero
PR_HP=`sed -n '1p' $HOME/Accuweather_conky_script/pression`
TEMP=`sed -n '3p' $HOME/Accuweather_conky_script/curr_cond`
PR_CALC=$(bc << EOF
scale=0
$PR_HP - 1000
EOF
)
echo "$DATE $PR_CALC $TEMP" >> $LOG
gnuplot <<EOF
set border linewidth 2.5
set terminal png enhanced size 300,170 transparent #font "Ubuntu,10" 400,350
set term png font "Ubuntu:style=Bold,14"
set output "$GRAPH"
unset key
set grid
set xzeroaxis lt 3 lw 2
set yzeroaxis
set ytics ("" -40, "" -20, "" 20, "" 40)
set mxtics 0
set xdata time
set timefmt "%s"
set xtics 86400
set format x "%d"
set style line 1 lw 2
set style line 2 lw 2
plot ["$DATE1WEEK":"$DATE"] [-40:50] "$LOG" using 1:3 with lines ls 2, "$LOG" using 1:2 with lines ls 1
EOF
exit 0
Especially this part
I've put my little knowledge into it but I can't find it
DATE=$(date +"%s")
DATE1WEEK=$(date --date="1 week ago" +"%s")
# liste des dates de releve du fichier log
EPOCH=()
while read
do
EPOCH+=( "$REPLY" )
done< <(awk '{print $1}' "$LOG")
# si le fichier existe et contient des valeurs de plus d'une semaine (premiere = plus vieille)
#supprimer premiere valeur
[[ -f $LOG ]] && {
for i in $(seq 0 $(($(wc -l < $LOG)-1)))
do
[[ $DATE1WEEK -gt ${EPOCH[$i]} ]] && sed -i '1d' $LOG || break
done
}
Many tanks.
@+
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
^ I hope the headache has stopped.
Try replacing DATE1WEEK=$(date --date="1 week ago" +"%s") with:
DATE1WEEK=$(date --date="1 day ago" +"%s")
If people would know how little brain is ruling the world, they would die of fear.
Offline
^ I hope the headache has stopped.
Try replacing DATE1WEEK=$(date --date="1 week ago" +"%s") with:
DATE1WEEK=$(date --date="1 day ago" +"%s")
If that works, change the name of the variable globally in the script so you don't get confused when you look at it months or years down the line... DATE1DAY or YESTERDAY instead of DATE1WEEK
Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me
Offline
^ Sure, but first let's see if it works.
If people would know how little brain is ruling the world, they would die of fear.
Offline
Ought to, date --date="1 week ago" and date --date="1 day ago" get me the correct answers in the same format..
You absolutely do not want to even think about trying to figure out yesterday's date in a DOS batch file, much less last week... You have to calculate it, because it won't accept an offset, just returns NOW, & then handle all the month transitions manually, & if yesterday happened to be the last day of February boy do the checks & figuring out the answer to return get hairy... differing length months are bad enough..
Oh & don't forget to strip leading zeros from what DOS DATE returns, because if you leave them it handles them as octal rather than decimal & your batch file gives strange answers...
Might have got easier now you can call powershell from a batch file it's date functions are somewhat more versatile, frankly I'd cheat NOW & install Windows subsystem for Linux.. just so I could call date from coreutils..
Unfortunately my last clash with that little problem was under Win 98 & no such luxuries were available.
Back on topic, since the OP is parsing a file $LOG I'm wondering if it's giving odd results from having insufficient entries as yet, only weekly, not daily. Or is awk possibly needing a tweak to what it's doing to create a $LOG with the required entries? Sorry my mind tends to blank when I see awk in a script...
Last edited by Bearded_Blunder (2024-08-12 14:13:05)
Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me
Offline
^ Yes.
The value is expressed in seconds (it is required for the script).
If we want hours and minutes:
$ date --date="1 day ago" +"%H:%M"
16:12
...
Back on topic, since the OP is parsing a file $LOG I'm wondering if it's giving odd results from having insufficient entries as yet, only weekly, not daily.
We don't know what $LOG looks like.
EDIT
awk '{print $1}'
That code only prints the first word in the line.
Last edited by marens (2024-08-12 14:35:21)
If people would know how little brain is ruling the world, they would die of fear.
Offline
We don't know what $LOG looks like.
No we don't, but we can infer it may only have weekly entries (cronjob?)
It's not going to magically grow the missing intervening days & can only return what's in there..
Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me
Offline
^ I agree with you.
The probability is small, but there is still a chance that the author left that possibility.
Maybe he was only interested in weekly values.
If people would know how little brain is ruling the world, they would die of fear.
Offline
Hello guys
Tanks for hekping .
listePression.log
1723455237 13 28
1723455283 13 28
1723455397 13 28
1723455443 13 30
1723455534 13 33
1723456379 13 33
1723456466 13 33
1723456547 13 33
1723458380 13 33
1723458408 13 36
1723458417 13 36
1723462520 13 36
1723462586 12 36
1723463797 12 36
1723464312 12 36
1723464367 12 36
1723464407 12 36
1723464443 12 36
1723464768 12 36
1723464831 12 36
1723464888 12 36
1723476784 12 36
1723477086 12 36
1723478559 11 36
1723478760 11 36
1723479202 11 36
1723480402 11 36
1723481618 11 33
1723482818 11 33
1723483894 11 33
1723483911 11 33
1723484024 11 33
1723485240 10 33
1723486174 10 33
1723486445 10 33
1723487646 10 33
1723488863 10 33
1723490063 10 33
1723491264 10 33
1723492480 10 27
1723493681 10 27
1723538777 9 27
1723538832 10 34
1723538852 10 34
1723538903 10 34
1723539549 11 34
1723539641 11 34
normal script
with
date --date="1 day ago" +"%S"
with
date --date="1 day ago" +"%H:%M"
@+
Last edited by loutch (2024-08-13 09:12:25)
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
If that's the complete log, there is only about 24 hours data in there (~23hrs 26min), I'm not entirely certain what the issue is...
The one you say is "normal script" looks about what you'd expect for it appearing on a graph that covers a week, the second looks about what you'd expect for a graph covering 1 day..
The graphs even look the same allowing for the stretched time axis in the second screen grab.
What problem are you seeing that I'm not?
I'm sure I'm missing something...
Last edited by Bearded_Blunder (2024-08-13 09:33:03)
Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me
Offline
Re
Oki-doki
I'm going to delete my .log, modify the script and leave it running. We'll see if anything changes in a few hours.
thanks again
@+
Linuxmint 22.1 Xia xfce & mageia 9 XFCE on ssd hp pavilion g7
Xubuntu 18.04 lts & 24.04 lts on ASUS Rog STRIX
Offline
@loutch
Where is listePression.log?
Daily or hourly forecast?
If it's in the hourly forecast, try:
DATE1WEEK=$(date --date="1 hour ago" +"%s")
If people would know how little brain is ruling the world, they would die of fear.
Offline
@loutch
I assumed that the first word in each line of the listPression.log file shows the time in seconds.
Then I used Epoch Converter:
https://www.epochconverter.com
These are the results for the first five and last five values:
Monday, August 12, 2024 11:33:57 AM
Monday, August 12, 2024 11:34:43 AM
Monday, August 12, 2024 11:36:37 AM
Monday, August 12, 2024 11:37:23 AM
Monday, August 12, 2024 11:38:54 AM
...
Tuesday, August 13, 2024 10:47:12 AM
Tuesday, August 13, 2024 10:47:32 AM
Tuesday, August 13, 2024 10:48:23 AM
Tuesday, August 13, 2024 10:59:09 AM
Tuesday, August 13, 2024 11:00:41 AM
As you can see, it is a ~24 hour period.
Unfortunately, I'm not familiar with the script you're using, but I hope this helps you find a solution.
EDIT
Now I see that the time in seconds can be converted using the terminal without Epoch Converter.
The first value in the listPression.log file is 1723455237.
$ date --date=@1723455237
Mon 12 Aug 2024 11:33:57 AM CEST
Last edited by marens (2024-08-13 16:35:20)
If people would know how little brain is ruling the world, they would die of fear.
Offline
I assumed that the first word in each line of the listPression.log file shows the time in seconds.
Then I used Epoch Converter:
https://www.epochconverter.com
I wasn't that inventive, I simply subtracted the lesser from the greater value at the ends of the file, then divided by 60 a couple of times, which gave me the number of hours it covered, subtracting the whole ours & multiplying by 60 gave me the minutes.
I was only intertested in how long it covered, not when.
Blessed is he who expecteth nothing, for he shall not be disappointed...
If there's an obscure or silly way to break it, but you don't know what.. Just ask me
Offline
^ Either way, the conclusion is the same.
It is a period slightly shorter than 24 hours.
Start:
Monday, August 12, 2024 11:33:57 AM
End:
Tuesday, August 13, 2024 11:00:41 AM
If people would know how little brain is ruling the world, they would die of fear.
Offline
@loutch
Instead of the diagram Temperature et pressure de la semaine, you can try to make Temperature et pressure horaire.
Sorry for my French (google translate).
If people would know how little brain is ruling the world, they would die of fear.
Offline