Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
unix
FI printers over Samba on Linux
Commits
8e963a10
Commit
8e963a10
authored
Feb 17, 2021
by
Martin Klimes (k11m1)
Browse files
fixed cron, run-parts
parent
a027150c
Changes
2
Hide whitespace changes
Inline
Side-by-side
cron.pl
View file @
8e963a10
...
...
@@ -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
");
}
install.pl
View file @
8e963a10
...
...
@@ -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
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment