Lines 42-59
my $shell = $opts{shell} || $ENV{SHELL} || '/bin/sh';
Link Here
|
42 |
|
42 |
|
43 |
# Now we're set up, build the 'su' command |
43 |
# Now we're set up, build the 'su' command |
44 |
my @su_args; |
44 |
my @su_args; |
45 |
push @su_args, '/bin/su'; |
45 |
push @su_args, '/usr/bin/sudo'; |
46 |
push @su_args, '--preserve-environment' if $opts{'preserve-environment'}; |
46 |
push @su_args, '--preserve-env' if $opts{'preserve-environment'}; |
47 |
push @su_args, '--login' if $opts{login}; |
47 |
push @su_args, '--login' if $opts{login}; |
48 |
push @su_args, '--command', |
48 |
push @su_args, "-u", "$instance-koha"; |
|
|
49 |
push @su_args, |
49 |
"env " |
50 |
"env " |
50 |
. "KOHA_CONF=/etc/koha/sites/$instance/koha-conf.xml " |
51 |
. "KOHA_CONF=/etc/koha/sites/$instance/koha-conf.xml " |
51 |
. "PERL5LIB=/usr/share/koha/lib $shell" |
52 |
. "PERL5LIB=/usr/share/koha/lib $shell" |
52 |
. ( $opts{command} ? " -c '$opts{command}'" : '' ); |
53 |
. ( $opts{command} ? " -c '$opts{command}'" : '' ); |
53 |
push @su_args, "$instance-koha"; |
|
|
54 |
|
54 |
|
55 |
print "Command: '".join("' '",@su_args)."'\n" if $opts{verbose}; |
55 |
print "Command: '".join("' '",@su_args)."'\n" if $opts{verbose}; |
56 |
system(@su_args); |
56 |
system("@su_args"); |
57 |
if ( $? == -1 ) { |
57 |
if ( $? == -1 ) { |
58 |
print STDERR "failed to execute: $!\n"; |
58 |
print STDERR "failed to execute: $!\n"; |
59 |
} |
59 |
} |
60 |
- |
|
|