Customize shutdown function for suspend problems
#1
Hi all,

I'm running Kodi 15.1 on Ubuntu 15.04. As PVR-Server I'm using DVBLink with a Cine S2.

As shutdown-function I have selected "suspend" in the Kodi settings.

Now I have the Problem, that my custom suspend/resume script in the director /lib/systemd/system-sleep/ don't work like a similar script in ubuntu 14.04 in the directory /etc/pm/sleep.d/.

If I use "pm-suspend" on the console like the standard in ubuntu 14.04, kodi suspend and resume perfect.
The skipt in /etc/pm/sleep.d/ will unload my CineS2 driver and shutdown DVBLink on suspend and loads the driver and start DVBLink again on resume.

If I use "systemctl suspend" on the console like the standard in ubuntu 15.04, kodi can't play TV after resume, because there are problems with unloading/loading driver while playing TV and problems with the start of DVBLink.

As a workaround I would like to execute pm-suspend instead of "systemctl suspend" when the shutdown-function is executed.

Is there a way to change the behavior?

Thanks in advance for your help.

Best Regards,
Marc
Reply
#2
Quote:Now I have the Problem, that my custom suspend/resume script in the director /lib/systemd/system-sleep/ don't work like a similar script in ubuntu 14.04 in the directory /etc/pm/sleep.d/.

Can you post this script? It should work there.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#3
E.g.:

Something in /usr/lib/systemd/system-sleep/remove-whatever.sh
Code:
#!/bin/bash
[ "$1" = "post" ] && exec /usr/sbin/modprobe YOUR_MODULE
[ "$1" = "pre" ] && exec /usr/sbin/rmmod YOUR_MODULE
exit 0
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#4
Hi!

This is my script:
Code:
#!/bin/bash
## 99_customSupend

echo "Execute 99_customSupend $1 at `date`" >>/usr/local/bin/scripts/standby.log
case $1 in
    pre)
            echo "Start suspend `date`" >>/usr/local/bin/scripts/standby.log
            echo "Stop DVBLink" >>/usr/local/bin/scripts/standby.log
               /usr/local/bin/dvblink/stop.sh >>/usr/local/bin/scripts/standby.log
            echo "Result: $?" >>/usr/local/bin/scripts/standby.log
            echo "Unload Driver Cine S2" >>/usr/local/bin/scripts/standby.log
                result=-1
                        i=1
                        while [ $i -le 100 -a $result -ne 0 ]
                            do
                    echo "$i. try" >>/usr/local/bin/scripts/standby.log
                            i=`expr $i + 1`
                  modprobe -rf ngene cxd2099 dvb_core >>/usr/local/bin/scripts/standby.log
                            result=$?
                            sleep 1
                            done
            echo "Result: $result" >>/usr/local/bin/scripts/standby.log
            echo "End suspend `date`" >>/usr/local/bin/scripts/standby.log
            echo >>/usr/local/bin/scripts/standby.log
        ;;
    post)
            echo "Start resuming `date`" >>/usr/local/bin/scripts/standby.log
            echo "Load Driver Cine S2" >>/usr/local/bin/scripts/standby.log
                modprobe -v ngene cxd2099 dvb_core >>/usr/local/bin/scripts/standby.log
            echo "Result: $?" >>/usr/local/bin/scripts/standby.log
            echo "Start DVBLink" >>/usr/local/bin/scripts/standby.log
                result=-1
                        i=1
                        while [ $i -le 100 -a $result -ne 0 ]
                            do
                            ps -aux | grep -v grep | grep dvblink_server > /dev/null
                            result=$?
                            if [ $result -ne 0 ]
                                then
                        echo "$i. try" >>/usr/local/bin/scripts/standby.log
                      /usr/local/bin/dvblink/start2.sh
                                fi
                            i=`expr $i + 1`
                            sleep 1
                            done
            echo "Result: $result" >>/usr/local/bin/scripts/standby.log
            echo "End resuming `date`" >>/usr/local/bin/scripts/standby.log
            echo >>/usr/local/bin/scripts/standby.log
        ;;
    *)  ## "Fehlerhafter Parameter beim Aufrufen dieses Skripts!"
        ##
        ;;
esac

Directory /usr/lib/systemd/system-sleep/ doesn't exist
Reply
#5
Make worth to ask on the systemd mailing list.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply
#6
Is it possible as a workaround to execute pm-suspend instead of "systemctl suspend" when the shutdown-function is executed.
Reply
#7
nope.
First decide what functions / features you expect from a system. Then decide for the hardware. Don't waste your money on crap.
Reply

Logout Mark Read Team Forum Stats Members Help
Customize shutdown function for suspend problems0