I want to source this /etc/apache2/envvars before running apache2 -V command which is giving me this output wihtout soruce
user@ubuntu16:~$ apache2 -V
[Tue Sep 14 05:01:39.045086 2021] [core:warn] [pid 13942] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Tue Sep 14 05:01:39.045115 2021] [core:warn] [pid 13942] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Tue Sep 14 05:01:39.045142 2021] [core:warn] [pid 13942] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Tue Sep 14 05:01:39.053712 2021] [core:warn] [pid 13942] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Tue Sep 14 05:01:39.053860 2021] [core:warn] [pid 13942] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Tue Sep 14 05:01:39.053878 2021] [core:warn] [pid 13942] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00543: apache2: bad user name ${APACHE_RUN_USER}
running the command source /etc/apache2/envvars from the terminal is making the above warn go away but I want to do this from the python script as I am calling the apache2 -V from my python script to do some parsing of the output.
I am using the command execfile to source the file but I am getting the error and not sure how to resolve this issue. Is there any right wayt to soruce this /etc/apache2/envvars file within python script
root@ubuntu16:/home/virsec# python
Python 2.7.12 (default, Mar 1 2021, 11:38:31)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> execfile("/etc/apache2/envvars")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/etc/apache2/envvars", line 4
unset HOME
^
SyntaxError: invalid syntax
>>>