1

When I place this command in a perl script, it won't work:

`chkconfig --level 3 nslcd on`; 

But if I execute it on a linux command shell, it works.

[root@barf Scripts]# chkconfig --level 3 nslcd on 

I'm curious on why it does't work in a perl script.

TIA

2
  • 2
    Doesn't work is a strong statement. Does it sit on the couch all day? Does it want more money? Is it on Serverfault all the time? Please be specific! Commented Mar 27, 2013 at 17:09
  • "Doesn't work" means the service did not start after a reboot. Commented Mar 27, 2013 at 20:09

1 Answer 1

0

Does using

print `chkconfig --level 3 nslcd on`; 

instead "fix" it? If yes, the answer is found here: https://stackoverflow.com/questions/799968/whats-the-difference-between-perls-backticks-system-and-exec

Backticks in Perl execute with a system() call, and their return value will be the STDOUT of the called command.

3
  • It didn't work (print chkconfig --level 3 nslcd on;) Maybe because a.pl calls b.pl which has the chkconfig --level 3 nslcd on in it? Commented Mar 27, 2013 at 20:02
  • After your clarification on the question: Do you run the perl script with root permissions as well? Commented Mar 28, 2013 at 6:46
  • Yes, I do run the perl script with root permissions. Commented Mar 28, 2013 at 14:35

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.