I'm using ASA 12 + Apache 2.4.12 + PHP 5.6.10 on Fedora 4.0.6 and the stack is running well. When restarting apache I need to manually source sa_config.sh from command line like this:

/usr/sbin/httpd -k stop
source /opt/sqlanywhere12/bin64/sa_config.sh
/usr/sbin/httpd -k start

My question is how to ensure that 'source /opt/sqlanywhere12/bin64/sa_config.sh' automatically executes before httpd starts? This is especially required when system boots.

Fedora 4.0.6 uses systemd, systemctl as service manager. On older systems I was able to insert the source command in the /etc/rc.d/init.d/httpd start() routine. This is not possible anymore.

asked 07 Jul '15, 17:12

Marko's gravatar image

accept rate: 0%

Adding ExecStartPre=/bin/bash -a -c 'source /opt/sqlanywhere12/bin64/sa_config.sh' to the .service file should cause the script to be run before Apache starts. I believe (but have not tested) that the -a bash set option should force the environment variables to carry over to the Apache environment.

Alternatively, you could set the appropriate environment variables (LD_LIBRARY_PATH, SQLANY12, etc.) using the Environment= field.

permanent link

answered 08 Jul '15, 08:53

Mikel%20Rychliski's gravatar image

Mikel Rychliski
accept rate: 30%

Solved with Environment= field. Thanks!

(08 Jul '15, 13:28) Marko


Thank you for the hints. Just came across the same problem under CentOS 7.3.1611 + Apache 2.4.6 + PHP 7.1.4 + ASA 17 and adding Environment=LD_LIBRARY_PATH=/opt/sqlanywhere17/lib64 at the beginning of [Service] section in the httpd.service file solved the problem.

(04 May, 09:59) Przemek Roman
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 07 Jul '15, 17:12

question was seen: 393 times

last updated: 04 May, 09:59