Skip to content

Instantly share code, notes, and snippets.

@bytepossum
bytepossum / check_motion.sh
Created September 5, 2015 14:20
Bash script for cron to check if motion is running and free disk space
#!/bin/bash
SERVICE='motion'
RUN_COMMAND='nice -n 10 /usr/local/bin/motion &'
LOGFILE=/home/pi/motion/motion.log
VOPATH=/media/data/motion # video output directory
LIMIT=90 # maximum disk usage
if [ ! $(pidof $SERVICE) ]
then
@bytepossum
bytepossum / stop_cam1.sh
Last active August 12, 2021 13:51
Bash script to stop RTSP recording
#!/bin/bash
VOPATH=/media/data/motion # video output directory
MPATH=/home/pi/motion # motion log directory
CAM=1
pidfile=$MPATH/cam$CAM.pid
if [ ! -f $pidfile ]; then
echo "PID file not found. Nothing to do."
else
@bytepossum
bytepossum / start_cam1.sh
Created September 5, 2015 14:14
Bash script to start RTSP recording
#!/bin/bash
VOPATH=/media/data/motion # video output directory
MPATH=/home/pi/motion # motion log directory
FFMPEG=/usr/local/bin/ffmpeg # path to ffmpeg
CAM=1
pidfile=$MPATH/cam$CAM.pid
if [ ! -f $pidfile ]; then
echo "PID file not found."
@bytepossum
bytepossum / random_wallpaper.sh
Created August 27, 2015 14:39
Bash script to set random wallpaper from directory using feh
#!/bin/bash
WLPDIR="$HOME/images/wallpapers/"
files=($WLPDIR*)
wlpfile=${files[RANDOM % ${#files[@]}]}
printf "Setting wallpaper to %s\n" "$wlpfile"
feh --bg-fill "$wlpfile"