Commit 8e963a10 authored by Martin Klimes (k11m1)'s avatar Martin Klimes (k11m1)
Browse files

fixed cron, run-parts

parent a027150c
......@@ -3,12 +3,12 @@ use File::Copy;
use strict;
if (-d "/opt/fi-printers") {
#check
print "Opt dir exits\n";
chdir "/opt/fi-printers";
my $output = `git pull --ff-only`;
if ($output eq "Already up to date.\n") {
print "Nothing to do";
# exit;
exit;
}
}
else
......@@ -18,11 +18,7 @@ else
}
# copy cron.pl into weekly cron
copy("/opt/fi-printers/cron.pl", "/etc/cron.weekly/fi_printers_cron.pl");
copy("/opt/fi-printers/cron.pl", "/etc/cron.weekly/fi_printers_cron");
my @files = glob( '/etc/cups/ppd/*.ppd' );
......@@ -36,9 +32,7 @@ for my $item (@files) {
}
for my $printer (@files) {
my $command = "/opt/fi-printers/install.pl --update $printer";
print "$command \n";
system($command);
system("/opt/fi-printers/install.pl --update $printer");
}
......@@ -9,6 +9,7 @@ use File::Path;
use File::Copy;
use File::Basename;
use Getopt::Long qw(:config bundling);
use FindBin '$RealBin';
#--------------------------------------------------------------------
......@@ -296,15 +297,16 @@ sub pre_TA5007ci {
}
sub check_cron {
if (! -e "/etc/cron.weekly/fi_printers_cron.pl") {
if (! -e "/etc/cron.weekly/fi_printers_cron") {
print "[PROMPT] Do you want to enable automatic updates via cron? [Y/n] ";
chomp(my $answer = <STDIN>);
if ($answer eq 'Y' || $answer eq 'y' || $answer eq '') {
print "[INFO] Installing cron.\n";
copy("cron.pl", "/etc/cron.weekly/fi_printers_cron.pl")
or die "Could not copy cron script\n";
chmod 0700, "/etc/cron.weekly/fi_printers_cron.pl";
copy("$RealBin/cron.pl", "/etc/cron.weekly/fi_printers_cron")
or die "[ERROR] Could not copy cron script\n";
chmod 0700, "/etc/cron.weekly/fi_printers_cron";
say "[INFO] Cron installed";
}
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment