How can I set environment variables in my Linux service for Asterisk even though it doesn't have a real user? How can I set environment variables in my Linux service for Asterisk even though it doesn't have a real user? bash bash

How can I set environment variables in my Linux service for Asterisk even though it doesn't have a real user?


Either set them in the startup script (/etc/init.d/yourdaemon), or put a line in that file that looks like:

. /etc/yourdaemon.env

and put the environment variables in that file, using the syntax export VAR=value. On Red Hat-like systems, I believe the correct place for such a file is /etc/sysconfig. Debian/Ubuntu seems to have /etc/default for this purpose.


If your distro of choice is now using systemd try systemctl edit --full asterisk.service and consider EnvironmentFile and Environment

These files normally live here: /etc/systemd/system/myservice.service e.g cron.service