Raspberry PI tty1 monitor autostart

We wanted to show a logfile on a display connected to a Raspberry PI.

As described in https://raymii.org/s/tutorials/Run_software_on_tty1_console_instead_of_login_getty.html we created the file: /etc/systemd/system/getty@tty1.service.d/override.conf with this content:

[Service]
ExecStart=
ExecStart=-/home/pi/monitor.sh
StandardInput=tty
StandardOutput=tty

[Install]
WantedBy=multi-user.target

The script started by systemd gets the current file in /home/pi/logs and tails it:

#!/bin/bash
(
  cd /home/pi/logs
  sleep 10
  fn=$(ls -t1 | head -n1)
  tail -F ${fn}
)

To reload and enable the service:

systemctl daemon-reload
systemctl restart getty@tty1.service

Openstreetcam fisheye removal

I record a lot of my cycling routes using a GoPro Hero 5 black mounted to my bike.
After recording I upload the images (1 images/sec) to openstreetcam.
But the face and car sign detection cannot cope with the fisheye in the GoPro images so I had to remove them before upload.

This is the script I use:

#!/bin/bash

MOGRIFY=`which mogrify`
if [ $? -eq 1 ]; then
  echo "you need to install imagemagick"
  exit 1
fi

if [ "$#" -ne 1 ]; then
  echo "Add folder to process as argument."
  exit 1
fi

source_folder=$1
path=`realpath $1`
dest_folder=`dirname $path`/z_fisheye/`basename $1`
source_count=`find $source_folder -name \*JPG | wc -l`
echo "number of files to process: ${source_count}"

if [ -f "${source_folder}/000_fisheye.done" ]; then
  echo "${source_folder} already processed!"
  exit
fi

mkdir -p $dest_folder
(
  cd $source_folder
  for photo in *.JPG; do
    if [ -f "${dest_folder}/${photo}" ]; then
      echo -n "."
    else
      $MOGRIFY -path ${dest_folder} -distort barrel "0 0 -0.2" ${photo}
      echo -n "."
    fi
  done | pv -pte -i0.1 -s${source_count} > /dev/null
)

# check if all images from source folder are in dest_folder
dest_count=`find $dest_folder -name \*JPG | wc -l`
if [[ $source_count == $dest_count ]]; then
  touch ${source_folder}/000_fisheye.done
fi
After all files in a folder are processed a file named 000_fisheye.done will be created in the source folder.
This helps finding the folders I can upload to openstreetcam.