Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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


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.