[mythtv-users] Recovering from transcode/bad seektable

Stephen Worthington stephen_agent at jsw.gen.nz
Sun Sep 27 04:03:25 UTC 2020


On Sat, 26 Sep 2020 14:04:22 -0700, you wrote:

>Thanks for your very concrete suggestions.  Unfortunately, I still can't
>view the video.
>Some details below, and a question: should I regenerate the seek table in
>myth?

If your root partition has been out of space for a while, the
recordedseek table has probably been corrupt for a while too.  Without
enough space the daily or weekly optimize_mythdb will not have fixed
the recordedseek table, and any recordings that were made after it
became corrupt probably have either no or invalid entries in
recordedseek.  So you should do mythcommflag --rebuild on all the
recordings since the recordedseek table became corrupt.  If you are
lucky you will have complaints from mythbackend about the bad
recordedseek table in the mythbackend.log files to tell you when it
first happened.  But if it was too long ago your older logs will have
already been deleted.  If you also do commercial flagging, then after
you do mythcommflag --rebuild for a recording, you will also need to
rerun the commercial flagging.  You will need to work out what
settings you use for commercial flagging to put on the command line.

I have a small systemd job that checks for sufficient free space for a
second copy of my recordedseek table when it is being checked and
repaired and tells me if my root partition is too low on space, to
avoid getting this problem.  It emails me when there is a problem, and
checks every hour:

root at mypvr:/etc/systemd/system# sc cat check-free-space.service
# /etc/systemd/system/check-free-space.service
[Unit]
Description=Check free space on /
After=time-sync.target
OnFailure=notify-failure@%n.service

[Service]
ExecStart=/bin/bash -c "/usr/local/bin/check-free-space.sh"

[Install]
WantedBy=multi-user.target

root at mypvr:/etc/systemd/system# sc cat check-free-space.timer
# /etc/systemd/system/check-free-space.timer
[Unit]
Description=Hourly root free space check.

[Timer]
OnCalendar=hourly
Persistent=true

[Install]
WantedBy=timers.target

root at mypvr:/etc/systemd/system# cat /usr/local/bin/check-free-space.sh
#!/bin/bash

DEFAULT_MIN=16106127360

if [ -z "$1" ]; then
    min_required=$DEFAULT_MIN
else
    REGEX="^[[:digit:]]*$"
    if ! [[ $1 =~ $REGEX ]] ; then
        min_required=$DEFAULT_MIN
    elif [[ $1 -eq 0 ]]; then
        min_required=$DEFAULT_MIN
    else
        min_required=$1
    fi
fi

root_free_space=$(($(stat -f --format="%a*%S" /)))
echo "Free space on root is $root_free_space"

if [ $root_free_space -lt $min_required ]; then
    # Free space too low for /etc/cron.daily/optimize_db to run safely
on
    # mythconverg.recordedseek table.
    echo "Free space too low (< $min_required)"
    exit 1
fi

# Free space is sufficient.
echo "Free space is sufficient (>= $min_required)"
exit 0

root at mypvr:/etc/systemd/system# cat notify-failure at .service
#notify-failure at .service:

[Unit]
Description=OnFailure for %i

[Service]
Type=oneshot
ExecStart=/usr/local/bin/onfailure.sh %i

root at mypvr:/etc/systemd/system# cat /usr/local/bin/onfailure.sh
#!/bin/bash

#
# Author: Kyle Manna <kyle at kylemanna.com>
#
# Simple systemd script used to be called via something like:
#
# Example Unit section of a service file:
#
# [Unit]
# ...
# Onfailure=failure-email@%i.service
#
#
# failure-email at .service:
#
# [Unit]
# Description=OnFailure for %i
#
# [Service]
# Type=oneshot
# ExecStart=/path/to/onfailure.sh %i
#

svc=${1-unknown}
email="root xxxxxx at xxxxxxxxx xxxx at xxxxx"

cat <<EOF | sendmail -i "$email"
Subject: [$HOSTNAME] OnFailure Email for $svc
# Status
$(systemctl status -l -n 1000 "$svc")
EOF


More information about the mythtv-users mailing list