Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Pb : svdrp, script and crontab



Hi,

reminder of the problem : can't update epg.data through svdrp when the
script is launched via crontab

1/ Here is some "crontab" that I've tried without success :

20 * * * * /usr/local/bin/epgsatprocessing
20 * * * * /bin/su - root -c /usr/local/bin/epgsatprocessing
20 * * * * /bin/su - root -c /usr/local/bin/epgsatprocessing >/dev/null


2/ Here is "epgsatprocessing"
====================================================================
#!/bin/sh
echo Tuning to EPG Channel
/usr/local/src/vdr/svdrpsend.pl CHAN 400
sleep 3
echo Downloading datas
cd /usr/local/src/mhwepg-0.4
./mhwepg -s S19.2E -e equiv.csn -o /video0/epg.csn.data
echo Transfering datas to VDR via svdrp
/bin/cat /video0/epg.csn.data | /usr/local/bin/loadepg.pl
echo All tasks ended.
====================================================================


3/ Here is "loadepg.pl" :
====================================================================
#!/usr/bin/perl
#
# 0.01 loadvdr (peter)
# 0.02 delete old entries before updating (peter)
# 0.03 dumped Net::Telnet because of lost connections
#
# please submit diffs to petera@gmx.net
#
# ./epg2timers < merkliste.html | perl -w loadvdr.pl
#
#

use Socket;
use Getopt::Std;

@resp = ();

$Dest = "localhost";
$Port = 2001;

$Timeout = 300; # max. seconds to wait for response

$SIG{ALRM} = sub { Error("timeout"); };
alarm($Timeout);

$iaddr = inet_aton($Dest)                   || Error("no host: $Dest");
$paddr = sockaddr_in($Port, $iaddr);

$proto = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto)  || Error("socket: $!");
connect(SOCK, $paddr)                       || Error("connect: $!");
select(SOCK); $| = 1;
Receive_void();

Send("PUTE");

while (defined ($line = <STDIN>)) {
  print STDERR "$line";
  SendNoResponse("$line");
}

Send(".");
Send("quit");
close(SOCK)                                 || Error("close: $!");



sub SendNoResponse
{
  my $cmd = shift || Error("no command to send");
  print SOCK "$cmd";
}

sub Send
{
  my $cmd = shift || Error("no command to send");
  print SOCK "$cmd\r\n";
  Receive();
}

sub Send_void
{
  my $cmd = $_[0];
  print SOCK "$cmd\r\n";
  Receive_void();
}

sub Receive
{
  while (<SOCK>) {
        chomp;
        push @resp,$_;
        last if substr($_, 3, 1) ne "-";
        }
}

sub Receive_void
{
  while (<SOCK>) {
        last if substr($_, 3, 1) ne "-";
        }
}

sub Error
{
  print STDERR "@_\n";
  close(SOCK);
  exit 0;
}
====================================================================

Any clue ?...

Regards.
Karim.
___________________________

>>> Powered by Nerim  <<<
___________________________







-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index