Scripts that I use on my Raspberry Pi #4

Sometimes you want that your Raspberry Pi connects many different wireless networks. To do this you just have to add file wpa_supplicant.conf to your memory card (You can do that example with notepad) and add this to it:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="petrilopia_home"
    psk="password"
    id_str="home"
    priority=1
}

network={
    ssid="petrilopianet_mobile"
    psk="password"
    id_str="mobile"
    priority=2
}

network={
    ssid="petrilopianet_guest"
    psk="password"
    id_str="guest"
    priority=3
}

Continue reading Scripts that I use on my Raspberry Pi #4

Scripts that I use on my Raspberry Pi #3

I normally use sendemail on my Rasberry Pi because it’s easiest way to send email from your Raspberry Pi Linux machine using command line.

Let’s first install sendemail:

apt-get install sendemail

Using sendemail is easy:

sendemail -xu LOGIN -xp PASSWORD -f FROM -t TO -s SERVER:PORT -o tls=yes -u "SUBJECT" -m "MESSAGE" -a ATTACHEMENT FILE

You might not need -xu, -xp or tls=yes but I have used those just to be sure.

So my typical sendemail line is pretty much like this:

Continue reading Scripts that I use on my Raspberry Pi #3

How to search Coronavirus Tracing App Koronavilkku users

Since finnish version of Coronavirus Tracing App called Koronavilkku was released I have been wanting to find out if it is possible to see how many Koronavilkku users there is around me. So I have been playing with this app for about two weeks now and it seems to be working.

Because of an old project I happened to have Bluetooth LE scanner called RaMBLE – Bluetooth LE Mapper installed on my phone, so I started with that. I found out that if I scan bluetooth LE devices and use “Service UUID” filter “FD6F” I could find Koronavilkku users around me. Because Koronavilkku is using “Google’s & Apple’s Exposure Notification Framework” you should get this work on other countries too.

First add filters: RaMBLe filters for Covid Blinker

And then just turn on the scanner: RaMBLe Covid Blinker Results

Now there is even app for this called UUID 0xFD6F Scanner but I find it much more interesting to use tools that you can use for many purposes than these kind of apps.

Continue reading How to search Coronavirus Tracing App Koronavilkku users

Scripts that I use on my Raspberry Pi #2

This simple script just checks if your Raspberry Pi is connected to the Internet or not. So using this script is really easy, it will make Raspberry Pi reboot itself if it’s not connected to the Internet or do something else to get it connected again. This has saved me so many times when I have been using my headless Raspberry Pi setup and when my Raspberry Pi has been connected to Internet via 3G/4G USB modem and it has lost the connection once again.

Continue reading Scripts that I use on my Raspberry Pi #2

Scripts that I use on my Raspberry Pi #1

This script checks what your current external IP address and will let you know if it has changed since the last time you checked. You can easily modify this script to make your Raspberry Pi send you an email of it’s external IP address and send email when it’s email address has changed so this is pretty useful script for many kind of headless Raspberry Pi uses.

#!/bin/sh

ip1=""
ip2=""
ip="/scripts/ip.txt"

[ ! -f $ip ] && touch $ip

read ip1 < $ip
ip2=$(wget -U 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4' -qO- ifconfig.me/ip)

 Continue reading Scripts that I use on my Raspberry Pi #1