Shutting down mythtv slaves while master backend keeps running

It took me several attempts to get it work: I have already have a 24/7 running server. This server should become the master backend so it can server videos, music, etc. but because my old PCI card are incompatible with the new hardware I still have to operate another machine (the old backend) which domiciled the DVB capture cards. This machine now should act as slave backend which should be controlled by the master backend (woken up and shutdown). All this can be done using mythtv mechanisms only (no ssh access or anything like that is required).

For simplicity and clearness I post the relevant parts of mythconverg’s settings table:

mysql> select * from settings where hostname = ‘mythbackend-slave1’;
+—————————–+————————————–+——————–+
| value                       | data                                 | hostname           |
+—————————–+————————————–+——————–+
| BackendServerIP             | 192.168.1.21                         | mythbackend-slave1 |
| SleepCommand                | /home/mythtv/bin/sleep               | mythbackend-slave1 |
| WakeUpCommand               | /usr/bin/wakeonlan xx:xx:xx:xx:xx:xx | mythbackend-slave1 |

(please replace xx:xx:xx:xx:xx:xx with the MAC address of the slave’s wakeonlan capable NIC)

mysql> select * from settings where hostname = ‘mythbackend-master;

+—————————–+————————————–+———–+
| value                       | data                                 | hostname  |
+—————————–+————————————–+———–+
| BackendServerIP             | 192.168.1.1                          | mythbackend-master |
| WakeUpCommand               |                                      | mythbackend-master |

mysql> select * from settings where hostname is null;
+———————————+—————————————-+———-+
| value                           | data                                   | hostname |
+———————————+—————————————-+———-+
| MasterServerIP                  | 192.168.1.1                            | NULL     |
| idleTimeoutSecs                 | 300                                    | NULL     |
| idleWaitForRecordingTime        | 10                                     | NULL     |
| StartupSecsBeforeRecording      | 300                                    | NULL     |
| SetWakeuptimeCommand            | /home/mythtv/bin/setwakeuptime.dummy   | NULL     |
| ServerHaltCommand               | sudo /sbin/poweroff                    | NULL     |
| preSDWUCheckCommand             | /home/mythtv/bin/checkShutdown         | NULL     |

SetWakeuptimeCommand has to be set because otherwise mythtv blamed me: N Scheduler scheduler.cpp:2920 (ShutdownServer) SetWakeuptimeCommand is empty, shutdown aborted

 

The scripts can be viewed/downloaded from/at https://gist.github.com/pfichtner/57e3756eb65512202186

 

The only issue is that there seems o be no possibility to influence the slave shutdown: After looking into the sources it seems that there is no chance to call a preSDWUCheckCommand script on the slave, e.g. for not shutting down a slave where a user is logged in

Advertisements
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s