Need Help with Script for Synology? Dvr Crashed nothing recorded

I had the dvr crash on me last night and did not record anything lastnight .. I have written a script to check if dvr is running but I need the location of the service to start it. I use a similar script to check other services and works great.

service=channels-dvr
if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
echo "$service is running!!!"
else
/etc/init.d/$service start
fi

    2019/07/14 18:31:07 [TNR] Closed connection to TVE-Comcast_SSO for ch6086 AMC
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x1f0 pc=0xc7ab9d]

goroutine 135 [running]:
github.com/fancybits/channels-server/dvr.(*Job).Run.func2(0x0)
	/home/vagrant/channels-server-x86_64/dvr/job.go:432 +0xd
github.com/fancybits/channels-server/dvr.(*Recorder).UpdateFile.func1(0xc000e6b0a0, 0x14d1028, 0xc000e6b0a0)
	/home/vagrant/channels-server-x86_64/dvr/db_files.go:42 +0x98
github.com/etcd-io/bbolt.(*DB).Update(0xc0008c8c00, 0xc0006458b0, 0x0, 0x0)
	/home/vagrant/gopath/pkg/mod/github.com/etcd-io/[email protected]/db.go:694 +0x90
github.com/fancybits/channels-server/dvr.(*Recorder).UpdateFile(0xc00020eb60, 0xc0003c00b0, 0x4, 0xc000645c40, 0xc0015f0160, 0xc00201e000, 0x8000)
	/home/vagrant/channels-server-x86_64/dvr/db_files.go:40 +0x97
github.com/fancybits/channels-server/dvr.(*File).Update(0xc00062ea00, 0xc000645c40, 0x0, 0x0, 0x0, 0x200000, 0x0)
	/home/vagrant/channels-server-x86_64/dvr/file.go:85 +0x4e
github.com/fancybits/channels-server/dvr.(*Job).Run(0xc00062e000, 0xc00020ec30, 0x0, 0x0)
	/home/vagrant/channels-server-x86_64/dvr/job.go:431 +0x17e3
github.com/fancybits/channels-server/dvr.(*Recorder).RunRecorder.func1(0xc00020eb60, 0xc00062e000)
	/home/vagrant/channels-server-x86_64/dvr/recorder.go:533 +0xa3
created by github.com/fancybits/channels-server/dvr.(*Recorder).RunRecorder
	/home/vagrant/channels-server-x86_64/dvr/recorder.go:530 +0x49d
2019/07/15 05:24:36 [SYS] Starting Channels DVR v2019.07.15.0007 (linux-x86_64 pid:24088) in /volume1/@appstore/ChannelsDVR/channels-dvr/data

Thanks for reporting this crash. It has been fixed in the latest version.

The synology uses a start-stop-status file that's part of the DVR spk package. I'm not sure where they put it however, and it also requires specific environment variables to be set before you can invoke it.

Thanks .. We need some kind of notification when it crashes as I lost a full day of Prime recording. I will see if I can find a bash script to notify me if it is not running.

Most of our NAS packages will automatically restart the DVR if it crashes. The Synology package is one of the oldest and hasn't been updated to do the same.

Losing recordings really sucks- I'm sorry that happened. This is a new bug that snuck into the beta releases.

I added a Scheduled task to start the Service every hour it does nothing if it is already running that will do for now until the package is updated once again Thanks.

Cool. Can you paste a screenshot of the task settings in case someone else wants to replicate it?

Using Synology Task Scheduler.

task0
task1
task2

3 Likes