Author Topic: Server message question?  (Read 491 times)

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Server message question?
« on: June 14, 2011, 05:12:31 am »


                How would I send a server message that players see ingame from the linux command prompt or a bash script?

I have searched but cant find this.
               
               

               
            

Legacy_Calvinthesneak

  • Hero Member
  • *****
  • Posts: 1159
  • Karma: +0/-0
Server message question?
« Reply #1 on: June 14, 2011, 07:48:11 am »


               Depends on if you're using the nwservctl.sh script that skilladron and I suggested.

If you are you can simply use the

./nwservctl.sh say (your message)


This isn't an entire script, I have it posted somewhere else I think.....

#!/bin/bash

cd /home/nwnserver/nwn

./nwservctl.sh say -------------------------------------------
sleep 1
./nwservctl.sh say NOTE: SERVER WILL BE RESTARTING IN 30 MINS PLEASE SAVE AND BE READY
sleep 1
./nwservctl.sh say -------------------------------------------
sleep 600
.....
.....


               
               

               


                     Modifié par Calvinthesneak, 14 juin 2011 - 06:49 .
                     
                  


            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Server message question?
« Reply #2 on: June 14, 2011, 01:21:54 pm »


               Thanks Calvinthsneak.

Let me explain what Im doing exactly.(trying to do lol)

Im using the nwserctl.sh to run the RP server  and that tells the nwsever its going to restart with this in crontab -e        ~/nwservctl.sh restart countdown 120

I have another server on same machine I tinker with ..usually my lvlup one but sometimes do a campaign. I have 2 scripts to start it and stop it .I just wanted to also send messages to it .

btw second program I renamed nw_server so maybe something like this?

#!/bin/bash

cd /home/dan/NWN1

./nw_server say -------------------------------------------
sleep 1
./nw_server say NOTE: SERVER WILL BE RESTARTING IN 30 MINS PLEASE SAVE AND BE READY
sleep 1
./nw_server say -------------------------------------------
sleep 600
.....
.....
               
               

               
            

Legacy_Calvinthesneak

  • Hero Member
  • *****
  • Posts: 1159
  • Karma: +0/-0
Server message question?
« Reply #3 on: June 14, 2011, 05:26:27 pm »


               Yup sounds about right.  The way that script works, is it looks for specific commands.  stop, start, restart, status, a few others.  If it doesn't get any of those wayyyyy at the bottom the command falls through to the nwserver process to try and handle.  So when you use say, it simply uses the nwserver interfact to send a message.

The script name doesn't matter so much as what PID it's tied to.  so as long as you're using the name of the script tied to the right PID, it will push the command to that server.