bugy / script-server

Web UI for your scripts with execution management
Other
1.61k stars 249 forks source link

Trouble with Script to Launch Binary in Another Directory #499

Open invictus2010 opened 3 years ago

invictus2010 commented 3 years ago

Hi there!

I have a script that I use to launch a game server. It works well in the terminal, but I think script-server is not navigating to the other directories as required by the script. Here's the relevant section of code that I think is not running properly:

export NWNX_CORE_LOAD_PATH=~/nwnx/Binaries
LD_PRELOAD=~/nwnx/Binaries/NWNX_Core.so \
 ./nwserver-linux \

What script configuration settings should I play with to get this working?

bugy commented 3 years ago

Hey, please check this one https://github.com/bugy/script-server/wiki/Script-config#working_directory

invictus2010 commented 3 years ago

Thanks for the reply! I know that I have set the working directory correctly, because the script starts to run. I'm not sure that it is handling the script's reference to binaries in other directories. Does that make sense?

bugy commented 3 years ago

Yes, this should also affect paths, used by the script

invictus2010 @.***> schrieb am So., 24. Okt. 2021, 04:07:

Thanks for the reply! I know that I have set the working directory correctly, because the script starts to run. I'm not sure that it is handling the script's reference to binaries in other directories. Does that make sense?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/499#issuecomment-950247304, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJXPJIRM27YA6F53YXN44TUINS6FANCNFSM5GSSH4TQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

invictus2010 commented 3 years ago

If the script is stored in ~, the working directory would be ~ right? Thanks for your responsiveness--I know this is a newbie question :)

bugy commented 3 years ago

Yes :)

invictus2010 @.***> schrieb am Mo., 25. Okt. 2021, 03:04:

If the script is stored in ~, the working directory would be ~ right? Thanks for your responsiveness--I know this is a newbie question :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/499#issuecomment-950438904, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJXPJL5VGHNGYLJMVLAP6LUISUIRANCNFSM5GSSH4TQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

invictus2010 commented 2 years ago

Not sure why the following doesn't work... The script works when I run it from the terminal but doesn't start the game when I run it from script-server.

I know that the script runs because it will detect if the game is already running and will echo the appropriate message. So something is going wrong downstream of that.

MODNAME=Hazev3

status=$(./mod-status.sh)
if [ "$status" -eq "1" ]; then
    echo "$MODNAME is already running"
    exit;
fi

if [ -f /home/nwn/.mod-maintenance ]; then
    echo "$MODNAME maintenance in progress (.mod-maintenance file exists), not starting"
    exit;
fi

# Make a backup of all characters each time the server restarts
./mod-savechars.sh

pushd ~/nwn/bin/linux-x86
export NWNX_TWEAKS_HIDE_CLASSES_ON_CHAR_LIST=y
export NWNX_TWEAKS_HIDE_PLAYERS_ON_CHAR_LIST=1

# Keep all logs in this directory
LOGFILE=~/logs/mod-`date +%s`.txt
echo "Starting $MODNAME. Log is $LOGFILE"

# Set game options below

export NWNX_CORE_LOAD_PATH=~/nwnx/Binaries
LD_PRELOAD=~/nwnx/Binaries/NWNX_Core.so \
 ./nwserver-linux \
  -module "$MODNAME" \
  -maxclients 96 \
  -minlevel 1 \
  -maxlevel 10 \
  -pauseandplay 0 \
  -pvp 2 \
  -servervault 1 \
  -elc 0 \
  -ilr 0 \
  -gametype 3 \
  -oneparty 0 \
  -difficulty 3 \
  -autosaveinterval 0 \
  -dmpassword '' \
  -servername 'Haze: Saltborne' \
  -publicserver 1 \
  -reloadwhenempty 0 \
  -port 5121 \
-nwsyncurl http://157.230.0.160/nwsync \
  "$@" >> $LOGFILE 2>&1 &

echo $! > ~/.modpid 
popd 
bugy commented 2 years ago

Hi @invictus2010 to be honest I don't understand what the script is doing :sweat_smile: Where is the actual command to start the game? Is it nwserver-linux? Do you see anything in the game log file? Also, you may want to try solutions from this ticket: https://github.com/bugy/script-server/issues/482