Go to advanced search

by Bosse_B
Sun Mar 10, 2019 10:45 am
Forum: General discussion
Topic: Need to script ftp transfers from RPi to public webserver
Replies: 14
Views: 372

Re: Need to script ftp transfers from RPi to public webserver

Note that I am using a commercial provider for my websites and I have no way to enable or configure the server side functionality. I simply have to use whatever they say I should use and for file uploads to the website they guide towards using FTP. I tried using FileZilla to connect explicitly to sf...
by Bosse_B
Sun Mar 10, 2019 7:50 am
Forum: General discussion
Topic: Need to script ftp transfers from RPi to public webserver
Replies: 14
Views: 372

Re: Need to script ftp transfers from RPi to public webserver

OK, I now see the sftp:// error where I did only have sftp:/ But it did not work anyway when I tested it.... So I switched to curl instead and wrote a script that uses curl and plain ftp to do the job. Then I locked down the script so it can't be read by anyone else than me because inside the script...
by Bosse_B
Sat Mar 09, 2019 8:43 pm
Forum: General discussion
Topic: Need to script ftp transfers from RPi to public webserver
Replies: 14
Views: 372

Re: Need to script ftp transfers from RPi to public webserver

Thanks, I saw this only after posting my reply above... I will try this suggestion. :) I tried the suggestion after installing lftp and creating the .netrc file but fell flat: ~$ lftp -e "pwd; bye" sftp:/xxxxxxx.[email protected].xxx.xx lftp: sftp: Name or service not known [email protected]:~$ which s...
by Bosse_B
Sat Mar 09, 2019 8:17 pm
Forum: General discussion
Topic: Need to script ftp transfers from RPi to public webserver
Replies: 14
Views: 372

Re: Need to script ftp transfers from RPi to public webserver

If you can't use authorized_keys and you're happy to have your sftp username (but not password) in the history buffer you could use lftp and .netrc create a .netrc ( note the dot) in the user's home directory file with the following contents:- machine ftp.foo.bar login username password password mo...
by Bosse_B
Sat Mar 09, 2019 8:15 pm
Forum: General discussion
Topic: Need to script ftp transfers from RPi to public webserver
Replies: 14
Views: 372

Re: Need to script ftp transfers from RPi to public webserver

There is an extension to TCL called Expect which would allow password-based logins over SFTP, but again, really, keys are the way to go. Expect does not exist on my Linux machines... which expect returns nothing at all. It's 2019. FTP needs to go away and never be mentioned again. The company that ...
by Bosse_B
Sat Mar 09, 2019 6:03 pm
Forum: General discussion
Topic: Need to script ftp transfers from RPi to public webserver
Replies: 14
Views: 372

Need to script ftp transfers from RPi to public webserver

I need to script regular transfers of rather big binary files from the RPi to my webhosting server. I was thinking of using sftp, but I have stumbled on the password entry because I don't want it to be part of the command line (will appear in history). But it must be possible to run from cron or sim...
by Bosse_B
Thu Mar 07, 2019 12:28 pm
Forum: Raspbian
Topic: ddclient configuration for quick response?
Replies: 2
Views: 102

Re: ddclient configuration for quick response?

Not really, the RPi is headless and only has a command line interface.
I use it via PuTTY and for that I need to know the IP address of the router.

So I am really mostly interested in the ddclient operations.
by Bosse_B
Thu Mar 07, 2019 11:34 am
Forum: Raspbian
Topic: ddclient configuration for quick response?
Replies: 2
Views: 102

ddclient configuration for quick response?

I have an RPi3 sitting as a temperature and humidity logger in my summer home. It is connected to the Internet via a mobile broadband router. The site is 100 km away and in wintertime I don't often go there. I have installed ddclient on the RPi in order to set the ip address of the dynamic host I us...
by Bosse_B
Mon Feb 18, 2019 7:32 pm
Forum: Raspbian
Topic: Bash script command to check swap and show error?
Replies: 8
Views: 498

Re: Bash script command to check swap and show error?

Yes sed is not what I am fluent in.. And in this case you would also have to know the file that holds swap info as well as the way to find the data item... free as a general command seems a bit more in line with what I am comfortable with as well as the grep, head and tail commands. New to me this t...
by Bosse_B
Sun Feb 17, 2019 10:50 pm
Forum: Raspbian
Topic: Bash script command to check swap and show error?
Replies: 8
Views: 498

Re: Bash script command to check swap and show error?

Through googling I found that grep is capable of extracting data too. So this is the original command to get the Swap data: $ free | grep Swap Swap: 102396 9984 92412 If I feed the response string into another grep I get this: $ free | grep Swap | grep -P -o "[0-9]+" | head -1 102396 So this is what...
by Bosse_B
Sun Feb 17, 2019 8:13 pm
Forum: Raspbian
Topic: Bash script command to check swap and show error?
Replies: 8
Views: 498

Re: Bash script command to check swap and show error?

You could use AWK: free | awk '$1~/Mem/&&$2>1000000{print $2; exit 1}'; echo $?; That'll work within an if-then-else shell statement. I made some tests with this by putting it into a test.sh file. After changing Mem to Swap and 1000000 to 100000 the result I got was two lines: 102396 (this is the s...
by Bosse_B
Sun Feb 17, 2019 5:31 pm
Forum: Raspbian
Topic: Bash script command to check swap and show error?
Replies: 8
Views: 498

Bash script command to check swap and show error?

I have a script I use on new RPi units to install some software tools from source. It works really well provided that the swap is set to 1GB but I tend to forget this and if it is the standard 100M then the scripted build winds into a problem some 30 minutes later. The error message does not say it ...
by Bosse_B
Tue Jan 29, 2019 5:03 pm
Forum: General discussion
Topic: WiFi temperature sensor for RPi3?
Replies: 24
Views: 14316

Re: WiFi temperature sensor for RPi3?

This is my thread from Sept 2017...... Seems like it is not really in use of revival. I have solved my logging task in a different way (DIY). So, I can supply the following updated information concerning Temp/Humidity logging: 1) Using RPi as controller A DHT sensor type AM2302 can be connected dire...
by Bosse_B
Tue Jan 15, 2019 9:04 am
Forum: General discussion
Topic: Checking Internet connectivity in startup script?
Replies: 9
Views: 545

Re: Checking Internet connectivity in startup script?

Several reasons for the report: 1) To know the IP address in order to connect All of my RPi units are headless, and they are not always sitting on a network where I can manage the router DHCP reservations. And sometimes I move them to new networks and so I always put this on my RPi units to help in ...
by Bosse_B
Mon Jan 14, 2019 10:24 am
Forum: General discussion
Topic: Checking Internet connectivity in startup script?
Replies: 9
Views: 545

Re: Checking Internet connectivity in startup script?

Yes, I think I have it nailed now. The application is for a remote installation where the RPi is monitoring the temp/humid in our summer home. It is located remotely and uses a mobile broadband router. There are occasional power outages and for these the RPi will start up almost instantly when power...
by Bosse_B
Sun Jan 13, 2019 1:48 pm
Forum: General discussion
Topic: Checking Internet connectivity in startup script?
Replies: 9
Views: 545

Re: Checking Internet connectivity in startup script?

PS. Love Sweden. Beautiful country. I have been there twice with my wife in the last three years and hope to go again soon :-) Well, Stockholm has sent in its application for the 2026 Winter Olympics on Friday... Only one competitor, Italy, but they hosted the games in 2006 so maybe February 2026 c...
by Bosse_B
Sun Jan 13, 2019 11:55 am
Forum: General discussion
Topic: Checking Internet connectivity in startup script?
Replies: 9
Views: 545

Re: Checking Internet connectivity in startup script?

Thank you! This works as I want for these cases: OK - URL exists and responds (the one that will be used later in a curl call) NOK - URL exists but does not respond (my home router set to not respond to ICMP tests) NOK - URL does not exist so there will be a DNS error No extraneous output in this ca...
by Bosse_B
Sun Jan 13, 2019 10:03 am
Forum: General discussion
Topic: Checking Internet connectivity in startup script?
Replies: 9
Views: 545

Checking Internet connectivity in startup script?

As I have described in this thread (as yet not replied to) I need to call a php script on my website when my RPi starts up in order to report the IP address it has received. So I have written a shellscript, which is called in the startup process, and it works fine if the RPi is booted in a good envi...
by Bosse_B
Sat Jan 12, 2019 10:40 am
Forum: Raspbian
Topic: Detecting curl return error and wait in loop?
Replies: 0
Views: 465

Detecting curl return error and wait in loop?

I have a report script which runs on boot in order to send a message to myself when the RPi starts up containing the current IP address of the RPi. The script was created in order to be able to move the RPi between networks and after startup find its address easily to use when connecting with PuTTY ...
by Bosse_B
Wed Jan 09, 2019 8:45 pm
Forum: General discussion
Topic: Can RPi "cast" a video file to a Chromecast unit?
Replies: 3
Views: 1170

Re: Can RPi "cast" a video file to a Chromecast unit?

OK, then it seems simpler to use an RPi box with OSMC (KODI) on the other TV and let it mount the drive on the main OSMC box as a network store to play from. Same approximate cost for a ChromeCast and an RPi, except I have a few RPi units in my lab which are seldom used.... Except: I have to figure ...
by Bosse_B
Wed Jan 09, 2019 12:08 pm
Forum: General discussion
Topic: Can RPi "cast" a video file to a Chromecast unit?
Replies: 3
Views: 1170

Can RPi "cast" a video file to a Chromecast unit?

I have an RPi used as a media center with KODI (operating system OSMC). The user interface on this RPi is KODI as viewed via the attached HDMI screen (the TV in our living room). This server has a 1TB disk where I have collected a lot of videos like children's shows and science programs. The disk is...
by Bosse_B
Sun Jan 06, 2019 7:28 am
Forum: General discussion
Topic: No good at shellscripts, how to split data into an array?
Replies: 4
Views: 216

Re: No good at shellscripts, how to split data into an array?

You need to use curly brackets to let bash know that the array index is related to the variable otherwise it assumes the opening square bracket is the start of the next item and nothing to do with the variable. Also you might want to change how you create the array as your method will perform globb...
by Bosse_B
Sun Jan 06, 2019 7:24 am
Forum: General discussion
Topic: No good at shellscripts, how to split data into an array?
Replies: 4
Views: 216

Re: No good at shellscripts, how to split data into an array?

Why not have the PHP make a call to the AdafruitDHT.py using "system" or whatever PHP has. Then do all the splitting of the returned string in PHP? Sorry, I have not used PHP since about 2000 so I don't recall what facilities it has for running commands like that. The PHP script is a web server sid...
by Bosse_B
Sat Jan 05, 2019 11:43 pm
Forum: General discussion
Topic: No good at shellscripts, how to split data into an array?
Replies: 4
Views: 216

No good at shellscripts, how to split data into an array?

I am using an AdaFruit DHT library to read the humidity and temperature data from a sensor. When I call the library function it returns the following data on the command line: $ /home/pi/DHT/Adafruit_Python_DHT/examples/AdafruitDHT.py 22 4 T/H= 3.9 58.0 Now I want to process this in a shellscript an...
by Bosse_B
Fri Dec 07, 2018 7:49 pm
Forum: General discussion
Topic: How to read weather station sensor over 433MHz?
Replies: 17
Views: 1637

Re: How to read weather station sensor over 433MHz?

As you are finding; 433MHz RF can be a lot more complicated and difficult than it first seems. Right you are! I also tested my car key to see if it was indeed a 433 MHz device, and it was. But to my surprise the protocol for the key seems extremely simple! No wonder car thieves can easily record ke...

Go to advanced search