Both sides previous revisionPrevious revisionNext revision | Previous revision |
config:env [2010/02/22 13:17] – digitalman | config:env [2023/02/12 14:26] (current) – [Debian-based Linux] Provide a better example: put env vars in .profile, not .bashrc digital man |
---|
===== SBBSCTRL ===== | ===== SBBSCTRL ===== |
| |
The ''SBBSCTRL'' environment variable **should** be set to the path of your Synchronet ''[[dir/ctrl]]'' directory, **especially** if Synchronet is not installed in the default installation location (e.g. ''/sbbs/ctrl''). | The ''SBBSCTRL'' environment variable **should** be set to the path of your Synchronet ''[[dir:ctrl]]'' directory, **especially** if Synchronet is not installed in the default installation location (e.g. ''/sbbs/ctrl''). |
| |
| If this variable is **not** set, most //Synchronet// programs **allow** passing the //path// to the ''[[dir:ctrl]]'' directory as the **last** argument. |
| |
===== SBBSEXEC ===== | ===== SBBSEXEC ===== |
| |
The ''SBBSEXEC'' environment variable //may// be set to the path of your Synchronet ''[[dir/exec]]'' directory. This may be needed for some development situations. | The ''SBBSEXEC'' environment variable //may// be set to the path of your Synchronet ''[[dir:exec]]'' directory. This may be needed for some development situations (e.g. where your Synchornet ''exec'' directory is not ''../exec'' relative to your Synchronet ''[[dir:ctrl]]'' directory). Most sysops will not need to set this environment variable. |
| |
===== SBBSNODE ===== | ===== SBBSNODE ===== |
| |
The ''SBBSNODE'' environment variable **should NOT** be set. This variable is set dynamically((to the path of the current node directory)), by Synchronet, for the use of external online programs (e.g. doors). | The ''SBBSNODE'' environment variable **should NOT** be set by the sysop. This variable is set dynamically((to the path of the current node directory)), by Synchronet, for the use of external online programs (e.g. doors). |
| |
| |
===== Setting Environment Variables ===== | ===== Setting ===== |
| |
==== Windows NT ==== | ==== Windows NT ==== |
* Variable name: ''SBBSCTRL'' | * Variable name: ''SBBSCTRL'' |
* Variable value: ''c:\sbbs\ctrl'' | * Variable value: ''c:\sbbs\ctrl'' |
(replace ''c:\sbbs\ctrl'' with the full path to your ''[[dir/ctrl]]'' directory) | (replace ''c:\sbbs\ctrl'' with the full path to your ''[[dir:ctrl]]'' directory) |
| |
==== Windows 9x ==== | ==== Windows 9x ==== |
and add the line: | and add the line: |
SET SBBSCTRL=c:\sbbs\ctrl | SET SBBSCTRL=c:\sbbs\ctrl |
(replace ''c:\sbbs\ctrl'' with the full path to your ''[[dir/ctrl]]'' directory) | (replace ''c:\sbbs\ctrl'' with the full path to your ''[[dir:ctrl]]'' directory) |
| |
| ==== Debian-based Linux ==== |
| (Yes, this includes Ubuntu Linux) |
| |
| See https://wiki.debian.org/EnvironmentVariables |
| |
| Example ''~/.profile'' addition that both sets the ''SBBSCTRL'' variable and adds the Synchronet ''[[dir:exec]]'' directory to the search path: |
| <code sh> |
| export SBBSCTRL=/sbbs/ctrl |
| export PATH=$PATH:/sbbs/exec |
| </code> |
==== bash/sh ==== | ==== bash/sh ==== |
| |
For Unix bash/sh: | For Unix bash/sh: |
In the home directory of the user the BBS will be running as, edit the file | In the home directory of the user the BBS will be running as, edit the file |
named either ''.profile'' or ''.bash_profile'' depending on if you're running bash or | named either ''.profile'' or ''.bash_profile'' as appropriate and add the line: |
sh and add the line: | |
| |
SBBSCTRL=/sbbs/ctrl && export SBBSCTRL | SBBSCTRL=/sbbs/ctrl && export SBBSCTRL |
(replace ''/sbbs/ctrl'' with the full path to your ''[[dir/ctrl]]'' directory) | (replace ''/sbbs/ctrl'' with the full path to your Synchronet ''[[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 in 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's current value should be printed in response to either): |
| |
| * ''echo $SBBSCTRL'' |
| * ''printenv SBBSCTRL'' |
| |
| |
| |
==== csh/tcsh ==== | ==== csh/tcsh ==== |
| |
For Unix csh/tcsh: | For Unix csh/tcsh: |
Again, in the home directory of the user the BBS will be running as, in the | Again, in the home directory of the user the BBS will be running as, in the |
file named ''.tcshrc'' (for tcsh) or ''.cshrc'' (for csh) add the line: | file named ''.tcshrc'' or ''.cshrc'' as appropriate add the line: |
| |
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'' | |
| | ''PCBDRIVE'' | Current node drive letter | ''C:'' | |
| | ''PCBDIR'' | Current node path (sans drive letter) | ''\SBBS\NODE1\'' | |
| | ''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. |
| |
| |
| ===== See Also ===== |
| * [[:config:|Configuration]] |
| |
| {{tag>configuration operating_system}} |