Topic: [Guide][Script]Auto-Restart D2GS
Here's a simple script to restart D2GS in case of crashes.
Code Bash
#!/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 &
fi
sleep $INTERVALO
done
NOTE: Remember to change the path(directory) of your D2GS in script.
Exemple: wine /root/d2gs/D2GS.exe &
After the script is created, you must give it permission to execute.
chmod +x yourscript.sh
Okay, now just run your script.
NOTE: Do not use the name "D2GS" in your script title (ex: d2gs-script.sh) as it may double check and cause the process to fail to check.