question
#1

isit possible to make some script when my server crashes to start again by it self .?? i am using linux host, and i start the server from samp03svr file
Reply
#2

I think there are but may nit be good as if it continuously crashes might harm vps!
Reply
#3

i dont think is from the vps.. when someone comes in the server crashes. or when someone types command. but when i start the serever on windows 7 it never crashes.. and is not giving any errors inthe serverlog file. . the server just stops ..
Reply
#4

EDIT: Misread.
Reply
#5

1) cd /to/dir/with/samp03svr (Go to folder where samp03svr is located)
2) vi .restart.sh (Create a file called .restart.sh)
then paste this into it and save:

Код:
#!/bin/bash

log=samp.log
dat=`date`
samp="/root/samp03/samp03svr"
cd /root/samp03/



echo "${dat} watchdog script starting." >>${log}
while true; do
        echo "${dat} Server exited, restarting..." >>${log}
        mv /root/samp03/server_log.txt /root/samp03/logs/server_log.`date '+%m%d%y%H%M%S'`
        ${samp} >> $log
 sleep 2
done
Save!
If you don't use Vi and use nano, replace vi with nano
Reply
#6

guys this is the error i get .
[15:20:16] [debug] Server crashed while executing aG.amx
[15:20:16] [debug] AMX backtrace:
[15:20:16] [debug] #0 native fwrite () [0809aa10] from samp03svr
[15:20:16] [debug] #1 00012134 in ?? (0x00000000) from aG.amx
[15:20:16] [debug] #2 0001fda0 in public Pilot_Plane_LoadUnload (0x00000000) from aG.amx
[15:20:16] [debug] Native backtrace:
[15:20:16] [debug] #0 b741409b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[15:20:16] [debug] #1 b740f2d2 in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[15:20:16] [debug] #2 b740febc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[15:20:16] [debug] #3 b7410366 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[15:20:16] [debug] #4 b7413cec in ?? () from plugins/crashdetect.so
[15:20:16] [debug] #5 b777e600 in ?? ()
[15:20:16] [debug] #6 b7500667 in gsignal () from /lib/i386-linux-gnu/libc.so.6
[15:20:16] [debug] #7 b7503a52 in abort () from /lib/i386-linux-gnu/libc.so.6
[15:20:16] [debug] #8 b74f98f7 in __assert_fail () from /lib/i386-linux-gnu/libc.so.6
[15:20:16] [debug] #9 0809a63c in ?? () from ./samp03svr
[15:20:16] [debug] #10 0809aa9f in ?? () from ./samp03svr
[15:20:16] [debug] #11 08093d84 in ?? () from ./samp03svr
[15:20:16] [debug] #12 b740cb9c in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[15:20:16] [debug] #13 b7412d38 in ?? () from plugins/crashdetect.so
[15:20:16] [debug] #14 b74191f8 in amx_Exec () from plugins/crashdetect.so
[15:20:16] [debug] #15 b740f218 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[15:20:16] [debug] #16 b7412aa9 in ?? () from plugins/crashdetect.so
[15:20:16] [debug] #17 080e57a5 in ?? () from ./samp03svr
[15:20:16] [debug] #18 080acedb in ?? () from ./samp03svr
[15:20:16] [debug] #19 080a81ae in ?? () from ./samp03svr
[15:20:16] [debug] #20 b74ece16 in __libc_start_main () from /lib/i386-linux-gnu/libc.so.6
[15:20:16] [debug] #21 0804b4a1 in ?? () from ./samp03svr
Reply
#7

fwrite function crashed the server due to an invalid file handle. Read the wiki about how to check if the file opened successfully (therebefore the file handle is valid): https://sampwiki.blast.hk/wiki/Fwrite

And by the way, compiling with -d3 will let you know the line (in the script - the line that calls fwrite) that caused the crash: https://github.com/Zeex/samp-plugin-...ith-debug-info
Reply
#8

i dont get any errors in the gamemode .. so i dont know how to fix this. Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Header size: 10060 bytes
Code size: 996700 bytes
Data size: 3076176 bytes
Stack/heap size: 16384 bytes; estimated max. usage=4001 cells (16004 bytes)
Total requirements: 4099320 bytes
Reply
#9

I'll take the example of the wiki since I doubt you read it (if you did, you would understand the difference).

pawn Код:
// wrong:
new File:log = fopen("/ServerLog.txt", io_write);
fwrite(log, "Server started.\r\n");
fclose(log);
pawn Код:
// correct:
new File:log = fopen("/ServerLog.txt", io_write);
if(log)
{
    fwrite(log, "Server started.\r\n");
    fclose(log);
}
Reply
#10

where do i have to paste this ? in my gamemodeinit?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)