- Code: Select all
#!/usr/bin/perl
use strict;
use File::Spec::Functions;
open(CFGFILE,"/conf/config");
my @cfg_array = <CFGFILE>;
my $location = (grep(/RANDOM_MENUSHEETDIR='*'/,,@cfg_array));
close CFGFILE;
if (my @line = grep(/RANDOM_MENUSHEETDIR='(.*)'/,@cfg_array)) {
($location) = @line[0] =~ /RANDOM_MENUSHEETDIR='(.*)'/;
}
if (opendir(DIR,$location)) {
system("logger -t random_menusheetdir 'Failed to access $location!'");
die;
}
my @menusheetdirectories =(opendir(DIR,$location));
closedir(DIR);
my $numentries = @menusheetdirectories;
if ($numentries == 0) {
system("logger -t random_menusheetdir 'No valid wallpapers found in $location!'");
die;
}
my $directory = $menusheetdirectories[int rand $numentries];
system("config_tool -c MENUSHEETDIR=$directory");
system("/osd/etc/init.d/S99menusheets restart");
system("logger -t random_menusheetdir 'Changed MENUSHEETDIR'");
The script runs and completes the config_tool -c
but it always runs it as config_tool -c MENUSHEETDIR=<empty/blank>
and yes directories do actually exist
here's what I get in /tmp/messages.txt
Dec 31 16:35:51 WDLXTVLIVE user.notice random_menusheetdir: Failed to access /tmp/mnt/E8FA-9D51/MENUSHEETS!
anybody see what I'm doing wrong, the rest of the project is already complete and in working order
KAD



