On startup I manually run source /usr/local/etc/credentials.sh
.
I've made a script /usr/local/etc/rc.d/load_credentials
to run command for me at start-up. However the script does not succeed:
$ /usr/local/etc/rc.d/load_credentials start
eval: source: not found
load_credentials
The script is based on the example in rc-scripting docs.
#!/bin/sh
. /etc/rc.subr
name="load_credentials"
start_cmd="${name}_start"
stop_cmd=":"
load_credentials_start()
{
source /usr/local/etc/psql_creds.sh
}
load_rc_config $name
run_rc_command "$1"
credentials.sh
export DB_USER="JimmyJohn"
export DB_PASS="password123"
EDITs
Moved files as advised by @Michael-O