Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Using CentOS I have rsyslog configured to send data to a python script via a shell execute action(^). I have python 2.7 installed, but when my script is called, the shell environment is referencing python2.4. Any ideas on how to get the external script to point at the right python version?

share|improve this question

1 Answer 1

Yes, put the absolute path to the correct python binary in your rsyslog.conf.

share|improve this answer
    
tried . ^/usr/local/bin/python path_to_script and received "exec: No such file or directory" error. Isn't there just a way to set the shell it opens to use the right path? –  RyanBrady Oct 7 '11 at 4:16
    
Did you nest the entire line in single quotes? double quotes? ^'/usr/local/bin/python path_to_script' –  mbrownnyc Oct 7 '11 at 10:41
    
yes. same error. In fact, if I stick quotes around an existing script, it throws the error. The shell that gets created is pretty bare. I have a test script that writes out the sys.path and os.environ to a file in /tmp and it lists the path as /usr/lib64/python2.4/.... if I run that script from a user, the shell environment has the right paths. Is there a way to modify the shell that rsyslog starts? –  RyanBrady Oct 7 '11 at 11:45
    
It likely starts a shell simply as the user for which it's assigned... you can modify their bash profile to adjust the $PATH? Also, you shouldn't have such a problem with rsyslog. It should execute the script, and that's it. My exposure to rsyslog is this (which I wrote). I don't use it now/yet in prod, so sorry to sort of blindly lead. –  mbrownnyc Oct 7 '11 at 13:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.