Go to advanced search

by Pete6
Wed Mar 11, 2020 3:29 am
Forum: Beginners
Topic: Bash subscripted variable output from for do done loop
Replies: 13
Views: 582

Bash subscripted variable output from for do done loop

I have a for do done loop and I'd like to get the output onto a set of bash variables similar to out[1], out[2], out[3] and so on. How may I achieve this please? A google search keeps showing me complex answers often related to array BUT, the output always seems to end up as $out. I need to use the ...
by Pete6
Thu Mar 05, 2020 2:19 am
Forum: Beginners
Topic: Adding seconds to epoch times
Replies: 4
Views: 257

Re: Adding seconds to epoch times

Hehe. Yes I do. Well spotted. I do not think that is my problem. I am trying another tack right now that may do the trick.
by Pete6
Wed Mar 04, 2020 11:29 pm
Forum: Beginners
Topic: Adding seconds to epoch times
Replies: 4
Views: 257

Re: Adding seconds to epoch times

Thank you. Thank worked for some parts of my script. I have posted the entire script here The problem is right at the end in the section contained between the two lines # ******************************************************************************* # Setup the Latitude and Longitude of your site #...
by Pete6
Wed Mar 04, 2020 7:48 pm
Forum: Beginners
Topic: Adding seconds to epoch times
Replies: 4
Views: 257

Adding seconds to epoch times

Having trouble adding seconds + or - to epoch times. I need to be able to adjust some timings and I have a variable which is a number that I input iin minutes. I then multiply this by 60 and add it to an existing epoch time. newtime = ( epochtime + mynum ) is what I am trying to do. I have tried jus...
by Pete6
Tue Mar 03, 2020 7:36 pm
Forum: Beginners
Topic: Mp4 and avi videos not playing in client browser
Replies: 1
Views: 113

Re: Mp4 and avi videos not playing in client browser

This was (and still is) a file permission problem. I resolved it by simply copying my video file into the /var/www/html directory. Now it plays perfectly everytime. I do not like this solution but as yet have not had time to ascertain the correct file permission needed in the video file's directory....
by Pete6
Mon Mar 02, 2020 11:40 pm
Forum: Beginners
Topic: Mp4 and avi videos not playing in client browser
Replies: 1
Views: 113

Mp4 and avi videos not playing in client browser

I seem to be asking an awful lot of question in this forum lately. I am going through a very steep (and enjoyable) learning curve. I have built an astronomy AllSky camera using a Pi3B and Pi Cam 2 with a wide angle lens. It is working well and I am nearing the end of my little project. You can see i...
by Pete6
Mon Mar 02, 2020 10:49 pm
Forum: Beginners
Topic: cron job not working
Replies: 3
Views: 139

Re: cron job not working

It seems to have been working all along. The problem was that cron resolved the -$(date +"%s") int a single epoch time. This meant it was copying the same file over and over. I have now put the command into a bash script and cron now runs that. It works.
by Pete6
Mon Mar 02, 2020 8:34 pm
Forum: Beginners
Topic: cron job not working
Replies: 3
Views: 139

Re: cron job not working

A good idea. Thanks. It did not make it work in cron although it still works either from the command line or in a shell script.

It now looks like this.

Code: Select all

*/2 * * * * /bin/cp -a /run/shm/webcam.jpg /home/allsky/pics/webcam-$(date +"%s").jpg
by Pete6
Mon Mar 02, 2020 7:52 pm
Forum: Beginners
Topic: cron job not working
Replies: 3
Views: 139

cron job not working

My cron job does not work. It is supposed to run every two minutes and to copy and rename a single files from one directory to another, */2 * * * * /bin/cp -a /run/shm/webcam.jpg "/home/allsky/pics/webcam-$(date +"%s").jpg" I have a number of cron jobs that are working and I am puzzled as to why thi...
by Pete6
Mon Mar 02, 2020 3:58 am
Forum: Beginners
Topic: Updating Sunrise, Sunset and Twilight in a service job
Replies: 5
Views: 267

Re: Updating Sunrise, Sunset and Twilight in a service job

I spent all day writing and fixing code. It now works. I need to leave it to run for a couple of days to make sure it is stable. I have a reboot at 4AM daily So I shall just wait and see but it looks very good so far.

Thanks you for your idea. It worked.
by Pete6
Mon Mar 02, 2020 3:52 am
Forum: Beginners
Topic: PHP not reading DS18B20 below 0C. Bash working
Replies: 6
Views: 235

Re: PHP not reading DS18B20 below 0C. Bash working

Thank you very much. It now works as advertised. I am sorry I got the code samples mixed up. Having a senior moment there I think.
by Pete6
Mon Mar 02, 2020 12:30 am
Forum: Beginners
Topic: PHP not reading DS18B20 below 0C. Bash working
Replies: 6
Views: 235

Re: PHP not reading DS18B20 below 0C. Bash working

Thank you. I would never have found that. AS I said, I picked this code up from here https://github.com/xillwillx/DS18B20 The same code is on a number of other sites too. I guess they all copied each other. Question: Can it be fixed. If so could you fix it please? If you would like to see my little ...
by Pete6
Sun Mar 01, 2020 10:56 pm
Forum: Beginners
Topic: PHP not reading DS18B20 below 0C. Bash working
Replies: 6
Views: 235

Re: PHP not reading DS18B20 below 0C. Bash working

I have no idea Dougie. I installed php, php-cgi and php-gd and it worked. To support the DS18B20 I just used the files from here https://github.com/xillwillx/DS18B20 which I incorporated into the webcam page that I got here https://www.dronkert.net/rpi/webcam.html . Please point me to the file where...
by Pete6
Sun Mar 01, 2020 9:49 pm
Forum: Beginners
Topic: PHP not reading DS18B20 below 0C. Bash working
Replies: 6
Views: 235

PHP not reading DS18B20 below 0C. Bash working

I have a problem with a php webpage on my Pi. The code below read a DS18B20 and diplays it in an image on a webpage. It all works fine until the temperature goes negative in C. Then php refuses to display the temperature. The code displays Unable to get temperature so I added $celsius = -1; $fahrenh...
by Pete6
Sun Mar 01, 2020 5:53 pm
Forum: Beginners
Topic: Updating Sunrise, Sunset and Twilight in a service job
Replies: 5
Views: 267

Re: Updating Sunrise, Sunset and Twilight in a service job

Charlotte is a nice place to live. I have been here for 6+ years. We moved here 'cuz our son moved here with his job. We are both retired and... "I love your British accent." Ashville is a great place. It's about 2 hours away. Meanwhile, I am making progress. I am not a programmer although I am seem...
by Pete6
Sun Mar 01, 2020 3:01 pm
Forum: Beginners
Topic: Updating Sunrise, Sunset and Twilight in a service job
Replies: 5
Views: 267

Re: Updating Sunrise, Sunset and Twilight in a service job

Yes, using sunwait to output a crontab will probably work. The nice thing about doing that would be that each time cron restarted (re-ran) the job it would output a new crontab file. I could even do a daily, 4AM reboot. I'll give it a go unless a demon coder shows up with another solution. Thank you.
by Pete6
Sat Feb 29, 2020 6:43 pm
Forum: Beginners
Topic: Updating Sunrise, Sunset and Twilight in a service job
Replies: 5
Views: 267

Updating Sunrise, Sunset and Twilight in a service job

I have built an astronomy AllSky camera. I based it on https://www.dronkert.net/rpi/webcam.html original files and with advice from here and some personal hacking it is working and has remained stable for a few days. My original thread is here https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=...
by Pete6
Sat Feb 29, 2020 6:25 pm
Forum: Beginners
Topic: Reading variables from a text file into Bash variables
Replies: 13
Views: 689

Re: Reading variables from a text file into Bash variables

Thanks Dougie, will do.
by Pete6
Sat Feb 29, 2020 4:13 pm
Forum: Beginners
Topic: Reading variables from a text file into Bash variables
Replies: 13
Views: 689

Re: Reading variables from a text file into Bash variables

Thank you to all who helped me make my astronomy AllSky Camera work. It has now been running and stable for a couple of days. I took it to my astronomy club and compared it with two other quite expensive devices. Mine is not as good but it showed up fairly well nonetheless. I can see stars down to m...
by Pete6
Tue Feb 25, 2020 7:18 pm
Forum: Beginners
Topic: Reading variables from a text file into Bash variables
Replies: 13
Views: 689

Re: Reading variables from a text file into Bash variables

@jojopi, I just re-read your comment about the Raspberry Pi camera. I am using the Pi-cam with an 8 Mega Pixel with Sony IMX219 CMOS image sensor and a 185 degrees lens. This is clearly not up with my ZWO astro camera but then the price was a little different too. I can detect stars down to just bel...
by Pete6
Tue Feb 25, 2020 4:10 pm
Forum: Beginners
Topic: Reading variables from a text file into Bash variables
Replies: 13
Views: 689

Re: Reading variables from a text file into Bash variables

Thank you both very much. I am making good progress here. My AllSky camera has not fallen over for nearly 24 hours which is progrees indeed. @GlowInTheDark The arithmetic syntax worked and multipication now abounds. I think that you are right. I am pushing my luck with a bash script. Learning Python...
by Pete6
Tue Feb 25, 2020 1:55 am
Forum: Beginners
Topic: Reading variables from a text file into Bash variables
Replies: 13
Views: 689

Re: Reading variables from a text file into Bash variables

That worked much better. Thank you. I am really a very bad programmer. However I am slowly moving from worse to bad if you see what I mean. I am now trying to multiply two things together. All it does is to allow the user to enter offsets in minutes rather than seconds. AstroDawnSec=AstroDawnMin * 6...
by Pete6
Mon Feb 24, 2020 10:02 pm
Forum: Beginners
Topic: Reading variables from a text file into Bash variables
Replies: 13
Views: 689

Re: Reading variables from a text file into Bash variables

Well the first part worked great. Thanks again. Now my if statement is broken # Time in Linux Epoch seconds and apply any adjustments # Astronomical Dawn Twilight date --date="$1" +%s aRise=$date echo $aRise # Sunrise date --date="$3" +%s sRise=$date echo $sRise # Sunset date --date="$4" +%s sSet=$d...
by Pete6
Mon Feb 24, 2020 9:25 pm
Forum: Beginners
Topic: Reading variables from a text file into Bash variables
Replies: 13
Views: 689

Re: Reading variables from a text file into Bash variables

Wow! Just like that. Amazing. It works perfectly.

Thank you both.
by Pete6
Mon Feb 24, 2020 7:53 pm
Forum: Beginners
Topic: Reading variables from a text file into Bash variables
Replies: 13
Views: 689

Reading variables from a text file into Bash variables

I have a text file called "times" 05:37, 19:37 07:00, 18:14 The numbers refer to astronomical twilight for dawn and dusk (top line) and sunrise and sunset the lower line. How can I get these into four separate variables in a bash script please. aRise aSet sRise sSet would be ideal names to use for t...

Go to advanced search