Skip to forum content

You are not logged in. Please login or register.


forums.pvpgn.pro → [EN] Diablo → [Guide][Script]Sending warning message

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 9

1

Topic: [Guide][Script]Sending warning message

I made a very useful script and I will share it with you.

I always restart my D2GS every seven days, so I made a bash script to always warn the Players when it will go into maintenance.

To create the script to restart the D2GS is to follow the same logic and to add in the crontab the scripts.


message.sh

#!/bin/bash
#
# set as variables
# password
passwd=abcd123
# message
msg="Hello World"
# d2gs telnet address
server="localhost 8888"
#
(echo $passwd; sleep 1;echo "msg sys #all \"$msg\" "; sleep 1) | telnet $server

Any questions please..

Diablo 2 Online

Itens - Armory - Market - Clans - Builds - Planner

2

Re: [Guide][Script]Sending warning message

Nice, simple and clean - I like it big_smile


I also have a basic bash script which will boot D2GS.exe if it disappears (crash attack). If people want it, I will post it up.

Owner of SlashDiablo - One of the oldest and most well known Diablo II servers
Admin of Resurgence - Vanilla++ mod
Co-Founder of Hellforged - Diablo 09 built on 1.13 engine (current work in progress)
Founder of Diablo2.org - Dedicated Discord server for PvPGN/D2GS questions

3

Re: [Guide][Script]Sending warning message

Feofilaktt wrote:

I made a very useful script and I will share it with you.

I always restart my D2GS every seven days, so I made a bash script to always warn the Players when it will go into maintenance.

To create the script to restart the D2GS is to follow the same logic and to add in the crontab the scripts.


message.sh

#!/bin/bash
#
# set as variables
# password
passwd=abcd123
# message
msg="Hello World"
# d2gs telnet address
server="localhost 8888"
#
(echo $passwd; sleep 1;echo "msg sys #all \"$msg\" "; sleep 1) | telnet $server

Any questions please..

your thing worked just fine for me. i just feel i should add some details

visit   https://crontab-generator.org/

choose interval

Command To Execute is the .sh file directory (mine is "/home/d2gs/restart_gs.sh")

copy the output (something like "0 */2 * * * /home/d2gs/restart_gs.sh >/dev/null 2>&1")

now on your vps(mine is CentOS):

crontab -e
i   #(to be able to insert)
paste previous output
esc
:wq

i merged announce and restart in one script

restart_gs.sh

#!/bin/bash
#
# set as variables
# password
passwd=abcd123
# message
msg="This host will restart in 2 minutes."
# d2gs telnet address
server="localhost 8888"
#
(echo $passwd; sleep 1;echo "msg sys #all \"$msg\" "; sleep 1;echo restart 121;sleep 1) | telnet $server

i'm waiting for Meanski to post his thing, meanwhile looking how to change the notification messages interval. every 15 sec is kinda too annoying

4

Re: [Guide][Script]Sending warning message

Meanski wrote:

Nice, simple and clean - I like it big_smile


I also have a basic bash script which will boot D2GS.exe if it disappears (crash attack). If people want it, I will post it up.

Can you post this? I'll be very thankful.

5

Re: [Guide][Script]Sending warning message

Here -> https://forums.pvpgn.pro/viewtopic.php?id=2058

Diablo 2 Online

Itens - Armory - Market - Clans - Builds - Planner

6

Re: [Guide][Script]Sending warning message

This is for windows if I am not mistaken...

7 (edited by Feofilaktt 26.07.2019 15:38)

Re: [Guide][Script]Sending warning message

hehpe wrote:

This is for windows if I am not mistaken...

Do you need to linux? Just write a simple bash script..

#!/bin/bash
#######################
# Script to monitor process #
#######################
# Name of process to be filtered
PROCESSO="D2GS"
# interval to be checked (in seconds)
INTERVALO=10
while true
do
# number of process copies running
OCORRENCIAS=`ps ax | grep $PROCESSO | grep -v grep| wc -l`
if [ $OCORRENCIAS -eq 0 ]
then
# If the number of processes running is 0, specify the actions to be taken.
wine /root/d2gs/D2GS.exe & >> /root/wine-d2gs.log
fi
sleep $INTERVALO
done

Done -> https://forums.pvpgn.pro/viewtopic.php?id=2103

Diablo 2 Online

Itens - Armory - Market - Clans - Builds - Planner

8

Re: [Guide][Script]Sending warning message

Meanski wrote:

Nice, simple and clean - I like it big_smile


I also have a basic bash script which will boot D2GS.exe if it disappears (crash attack). If people want it, I will post it up.

hi.

i want this script.

can you sent this script to me.

thank you.

9

Re: [Guide][Script]Sending warning message

Hyongza wrote:
Meanski wrote:

Nice, simple and clean - I like it big_smile


I also have a basic bash script which will boot D2GS.exe if it disappears (crash attack). If people want it, I will post it up.

hi.

i want this script.

can you sent this script to me.

thank you.

Here -> https://forums.pvpgn.pro/viewtopic.php?id=2103

Diablo 2 Online

Itens - Armory - Market - Clans - Builds - Planner

Posts: 9

Pages 1

You must login or register to post a reply

Who now at forum

Currently view post: 1 guest, 0 registered users

forums.pvpgn.pro → [EN] Diablo → [Guide][Script]Sending warning message