Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
config:env [2013/09/26 15:35] – [SBBSNODE] digital man | config:env [2018/04/23 17:15] – [bash/sh] Mention 'env' and 'printenv' utils for setting/testing environment changes digital man |
---|
(replace ''/sbbs/ctrl'' with the full path to your ''[[dir:ctrl]]'' directory) | (replace ''/sbbs/ctrl'' with the full path to your ''[[dir:ctrl]]'' directory) |
| |
| === /etc/profile === |
| In Debian and Debian-based Linux distributions (e.g. Ubuntu), you can also set environment variables in your ''/etc/profile'' file (and/or ''~/.profile''), like so: |
| |
| export SBBSCTRL=/sbbs/ctrl |
| |
| === env === |
| You may also use the ''env'' utility to set an environment variable for a specific program invocation: |
| |
| env SBBSCTRL=/sbbs/ctrl /sbbs/exec/sbbs |
| |
| Note: You can use the same syntax **without** the ''env'' part. The environment variable(s) specified will only be set for the life of the process being invoked. |
| |
| === sudo === |
| When using the ''sudo'' command to execute a Synchronet program with elevated (e.g. root) privileges, you may need to pass the ''-E'' option to preserve the environment variables set the parent shell: |
| |
| sudo -E sbbs |
| |
| === Testing === |
| |
| You can use either of the following command-lines to test if a particular environment variable is set correctly (the environment variable value should be printed in response to either): |
| |
| * ''echo $SBBSCTRL'' |
| * ''printenv SBBSCTRL'' |
| |
| |
| |
==== csh/tcsh ==== | ==== csh/tcsh ==== |
| |
setenv SBBSCTRL /sbbs/ctrl | setenv SBBSCTRL /sbbs/ctrl |
(replace ''/sbbs/ctrl'' with the full path to your ''[[dir:ctrl]]'' directory) | (replace ''/sbbs/ctrl'' with the full path to your ''[[dir:ctrl]]'' directory) |
| |
| |
| ===== Automatic ===== |
| |
| When the Synchronet [[server:Terminal]] Server executes an external program (e.g. door game, OS command shell, timed events, file transfer protocol drivers, etc.), it will set the following environment variables for the child process to utilize: |
| |
| ^ Variable Name ^ Description ^ Example ^ |
| | ''DSZLOG'' | Path to the current protocol driver log file | ''c:\sbbs\node1\protocol.log'' | |
| | ''SBBSNODE'' | Path to the current node directory | ''c:\sbbs\node1\'' | |
| | ''SBBSCTRL'' | Path to the Synchronet [[dir:ctrl]] directory | ''c:\sbbs\ctrl\'' | |
| | ''SBBSDATA'' | Path to the Synchronet [[dir:data]] directory | ''c:\sbbs\data\'' | |
| | ''SBBSEXEC'' | Path to the Synchronet [[dir:exec]] directory | ''c:\sbbs\exec\'' | |
| | ''SBBSNNUM'' | Current node number | ''1'' | |
| | ''PCBNODE'' | Current node number (only for DOS programs) | ''1'' | |
| | ''DAY'' | Current day of the month (01-31 ) | ''01'' | |
| | ''WEEKDAY'' | Current day of the week abbreviation | ''Mon''| |
| | ''MONTHNAME'' | Current month name abbreviation | ''Jan''| |
| | ''MONTH'' | Current month number (01-12) | ''01'' | |
| | ''YEAR'' | Current year | ''2017'' | |
| |
| These variables can be used by shell scripts, batch files and programs, as needed. |
| |
| |