YANO's digital garage

Copyright ©YANO All rights reserved. https://www.bravotouring.com/~yano/

Last-modified: 2024-04-17 (水)


[一語一絵/IT系]

epgrec:録画予約残骸削除 / 2012-12-13 (木)

メンテなどで電気的に止めたり、何らかの障害で録画に失敗したケースで録画予約情報がepgrecの表示上残ってしまう事が多々ある。

8日経過すると録画成功したものも含めて消されてしまうようだが、直近の予約番組がわかりづらいとまた止める判断をするのも一苦労なので、データベース上から綺麗サッパリ消してしまうことに。

yano@GT110b:~$ mysql -u root -p
Enter password: XXXXXXXX
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 136
Server version: 5.1.66-0ubuntu0.10.04.3 (Ubuntu)

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use epg;
mysql> select id, complete from Recorder_reserveTbl where endtime < now() and complete = 0;
+-----+----------+
| id  | complete |
+-----+----------+
| 302 |        0 |
| 304 |        0 |
+-----+----------+
2 rows in set (0.00 sec)

mysql> update Recorder_reserveTbl set complete = 1 where endtime < now() and complete = 0;
Query OK, 2 rows affected (0.04 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> \q
Bye
yano@GT110b:~$
SQL手順は~/mysql_script/epg_cleanup.sqlにファイル化しておいたので、今後はmysqlコマンド一撃でOK。
yano@GT110b:~$ cat ~/mysql_script/epg_cleanup.sql
use epg;
select id, complete from Recorder_reserveTbl where endtime < now() and complete = 0;
update Recorder_reserveTbl set complete = 1 where endtime < now() and complete = 0;
yano@GT110b:~$ mysql -pXXXXXXXX < ~/mysql_script/epg_cleanup.sql