Jump to content

andybe

Members
  • Posts

    10
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    ger

Recent Profile Visitors

1488 profile views

andybe's Achievements

Poring

Poring (1/15)

0

Reputation

  1. dear mod please move this to the propper section, I wasn't sure where to post this... Note: I tested this on ubuntu server! no idea what wil happen on other linux server. so after having to change a few lines in athena-start I made a script that will install athena-start as a service called rathena currently it only does start, stop and status and it does so very poorly cause I'm a real noob but I will update this post as I improve my skills. I will add watch and the other proper functionalities soon(ish): edited athena-start #!/bin/sh L_SRV=login-server C_SRV=char-server M_SRV=map-server INST_PATH=/opt PKG=rathena PKG_PATH=$INST_PATH/$PKG PATH=./:$PATH LOG_DIR="./log" DIR=`dirname $0` check_files() { for i in ${L_SRV} ${C_SRV} ${M_SRV} do echo "" if [ ! -f $DIR/$i ]; then echo "$i does not exist in $DIR... exiting..." exit 1; fi done } check_inst_right(){ if [ ! -w $INST_PATH ]; then echo "You must have sudo right to use this install (write/read permission in /opt/ )" && exit; fi } inst_launch_workaround(){ if [ -d $PKG_PATH ]; then if [ $(pwd) != $PKG_PATH ]; then cd $PKG_PATH; fi fi } inst_launch_workaround print_start() { # more << EOF echo "Athena Starting..." echo " (c) 2013 rAthena Project" echo "" echo "" echo "checking..." #EOF } get_status(){ PIDFILE=.$1.pid if [ -e ${PIDFILE} ]; then ISRUN=$(ps ax | grep $(cat ${PIDFILE}) | grep $1) PSRUN=$(echo "$ISRUN" | awk '{ print $1 }') fi #return ${PSRUN} #seem to cause issue for some os } #cheking if already started, launch and mark in log start_serv(){ get_status $1 if [ $2 ]; then #is logging on ? LOGFILE="$LOG_DIR/$1.launch.log" LOGRUN="$LOG_DIR/$1.log" FIFO="$1_fifo" echo "stat_serv, log is enabled" echo "My logfile=${LOGFILE}" if [ -z ${PSRUN} ]; then if [ -e .{FIFO} ]; then rm "$FIFO"; fi mkfifo "$FIFO"; tee "$LOGRUN" < "$FIFO" & "./$1" > "$FIFO" 2>&1 & PID=$! #"./$1" > >(tee "$LOGRUN") 2>&1 & PID=$! #bash only echo "$PID" > .$1.pid echo "Server '$1' started at `date +"%m-%d-%H:%M-%S"`" | tee ${LOGFILE} else echo "Can't start '$1', cause is already running p${PSRUN}" | tee ${LOGFILE} fi else if [ -z ${PSRUN} ]; then $DIR/$1& echo "$!" > .$1.pid echo "Server '$1' started at `date +"%m-%d-%H:%M-%S"`" else echo "Can't start '$1', cause is already running p${PSRUN}" fi fi } watch_serv(){ ulimit -Sc unlimited #now checking status and looping count=0; while true; do for i in ${L_SRV} ${C_SRV} ${M_SRV} do LOGFILE="$LOG_DIR/$i.launch.log" LOGRUN="$LOG_DIR/$i.log" FIFO=$i"_fifo" get_status $i #echo "Echo id of $i is ${PSRUN}" if [ -z ${PSRUN} ]; then count=$((count+1)) #echo "fifo=$FIFO" echo "server '$i' is down" echo "server '$i' is down" >> ${LOGFILE} echo "restarting server at time at `date +"%m-%d-%H:%M-%S"`" echo "restarting server at time at `date +"%m-%d-%H:%M-%S"`" >> ${LOGFILE} if [ -e $FIFO ]; then rm $FIFO; fi mkfifo "$FIFO"; tee "$LOGRUN" < "$FIFO" & "./$i" > "$FIFO" 2>&1 & PID=$! echo "$PID" > .$i.pid if [ $2 ] && [ $2 -lt $count ]; then break; fi fi done sleep $1 done } restart(){ $0 stop if [ $1 ]; then sleep $1; fi for i in ${L_SRV} ${C_SRV} ${M_SRV} do FIFO="$1_fifo" while true; do get_status ${i} if [ ${PSRUN} ]; then echo "'${i}' is still running p${PSRUN} waiting end"; sleep 2; else if [ -e .{FIFO} ]; then rm "$FIFO"; fi break fi done done $0 start } case $1 in 'start') print_start check_files echo "Check complete." echo "Looks good, a nice Athena!" if [ "$2" = "--enlog" ]; then ENLOG=1 if [ ! -d "$LOG_DIR" ]; then mkdir -p $LOG_DIR; fi echo "Logging is enable in $LOG_DIR" else echo "Logging is disable" fi for i in ${L_SRV} ${C_SRV} ${M_SRV} do start_serv $i $ENLOG done echo "Now Started Athena." ;; 'watch') if [ ! -d "$LOG_DIR" ]; then mkdir -p $LOG_DIR; fi if [ -z $2 ]; then Restart_count=10; else Restart_count=$2; fi if [ -z $3 ]; then Restart_sleep=3; else Restart_sleep=$3; fi echo " Gonna watch rA for Restart_count = $Restart_count, Restart_sleep= $Restart_sleep" for i in ${L_SRV} ${C_SRV} ${M_SRV} do start_serv $i 1 done watch_serv $Restart_count $Restart_sleep echo "Now watching Athena." ;; 'stop') for i in ${L_SRV} ${C_SRV} ${M_SRV} do PIDFILE=.${i}.pid if [ -e .{PIDFILE} ]; then kill $(cat ${PIDFILE}) rm ${PIDFILE} fi done ;; 'restart') restart ;; 'status') for i in ${L_SRV} ${C_SRV} ${M_SRV} do get_status ${i} if [ ${PSRUN} ]; then echo "'${i}' is running p${PSRUN}"; else echo "'${i}' seem down"; fi done ;; 'val_runonce') for i in ${L_SRV} ${C_SRV} ${M_SRV} do valgrind --leak-check=full --show-leak-kinds=all ./$i --run-once > "log/$i.runonce.leak" done ;; 'valchk') for i in ${L_SRV} ${C_SRV} ${M_SRV} do valgrind --leak-check=full --show-leak-kinds=all ./$i > "log/$i.runonce.leak" done ;; 'help') case $2 in 'start') echo "syntax: 'start {--enlog}'" echo "This option will starts the servs" echo "--enlog will tee all terminal output into a log/$servname.log file" ;; 'stop') echo "This option will shutdowns the servs'" ;; 'restart') echo "syntax: 'restart {<delay>}'" echo "This option will wait delay then will attempt to restart the servs" echo "NB, even if delay is over it will wait the pid is finished before atetmpting to restart servs" ;; 'status') echo "syntax: 'watch {<restart_intervall> <restart_count>}'" echo "This option let you know if the server are running or not" echo "NB this option is based on PID and supposed you have launch the serv by this script" echo " If it wasn't the case please use something like 'ps ax | grep server' to know their status" ;; 'watch') echo "syntax: 'watch {<restart_intervall> <restart_count>}'" echo "The watch option allow you to auto restart the server when this one was stopped" echo "<restart_intervall> delay in second before recheking if server are down (default 10) " echo "<restart_count> how many time should we restart servs (default 3), (-1=undefinitly)" ;; 'val_runonce') echo "syntax: 'val_runonce'" echo "This option will run valgrin with run-once to check the serv" ;; 'valchk') echo "syntax: 'valchk'" echo "This option will run valgrin with the serv" ;; *) echo "Please specify a command you'll like more info { start | stop | restart | status | watch }" read -p "Enter a valid command: " readEnterKey $0 "help" $readEnterKey ;; esac ;; *) echo "Usage: athena-start { start | stop | restart | status | watch | help | val_runonce | valchk }" read -p "Enter a valid option: " readEnterKey $0 $readEnterKey ;; esac and the init bash script file: you have to change the initial variables to your own settings and then it should be ready to go #!/bin/sh - ### BEGIN INIT INFO # Provides: rathena_server # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: rathena server # Description: Startup Init-Script for rathena server ### END INIT INFO # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="rAthena service" NAME=rathena #change the user USER=root BINARY=rathena #change path of the script file BINARY_BIN=/root/rathena #change name of the script file DAEMON=./athena-start PIDFILE=$BINARY_BIN/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed [ -x "$BINARY_BIN/$DAEMON" ] || exit 0 # Define LSB log_* functions. # Depend on lsb-base (>= 3.2-14) to ensure that this file is present # and status_of_proc is working. . /lib/lsb/init-functions # # Function that starts the daemon/service # do_start() { su $USER -s /bin/sh -c "$BINARY_BIN/$DAEMON start" } # # Function that stops the daemon/service # do_stop() { su $USER -s /bin/sh -c "$BINARY_BIN/$DAEMON stop" } # # Function that shows the status of to the daemon/service # do_status() { su $USER -s /bin/sh -c "$BINARY_BIN/$DAEMON status" } case "$1" in start) log_daemon_msg "Starting $DESC" "" do_start case "$?" in 0|1) log_end_msg 0 ;; 2) log_end_msg 1 ;; esac ;; stop) log_daemon_msg "Stopping $DESC" "" do_stop case "$?" in 0|1) log_end_msg 0 ;; 2) log_end_msg 1 ;; esac ;; status) do_status status_of_proc "$BINARY" "$DESC" && exit 0 || exit $? ;; restart) log_daemon_msg "Restarting $DESC" "" do_stop case "$?" in 0|1) do_start case "$?" in 0) log_end_msg 0 ;; 1) log_end_msg 1 ;; # Old process is still running *) log_end_msg 1 ;; # Failed to start esac ;; *) # Failed to stop log_end_msg 1 ;; esac ;; *) echo "Usage: $SCRIPTNAME {start|stop|status|restart}" exit 3 ;; esac : if you have no idea of this stuff you should first look up what an init-script or init-bash is or you wil have trouble installing and working with this.
  2. maybe for a cross server platform. I have a similar problem. but the short answer: no currently this is unsupported, though I am looking for a way to have the map server connect to multiple char servers myself and am eagerly studying how map and charserver interact. by the looks of it I will have a lot of work ahead of me though and sadly my time is limited
  3. well I was planning to make one but maybe someone already has? would save me the trouble to learn =D
  4. ty, but I already know that.... That was not what i was asking :/ good news though I found chrif.c which defines map server to charserver communication
  5. from the wiki I gathered that the general line of communication is as following: login<->char<->map the login server holds all the login information. Character server login to the login servers too with their own special account. login servers can handle multiple character servers and character servers can handle multiple map servers 1. Do the map servers use the same login data as the character servers? Or how are the map servers connected to the character servers? This is important to me because I am working on a cross server platform. there are several ways to make an implementation but modding the map server so it can connect to multiple character servers would seem like the most native approach to the already existing multiple map server per character server structure. I know this is a little more advanced than the usual stuff =D but I'm confident in my programming skills - I just need a few pointers into the right direction as to where I should start looking for making the correct changes cause frankly rathena is a large project >_> and reading through the entirety of the code will take me quite a bit of time.
  6. hi, I'm working on a stats overhaul and I'm trying to change the formular for the players attack value. what I'm anticipating : final attack = watk* batk/100 instead of the currently in place final attack = watk+batk from what I understand this should be the place where weapon attack meets base attack: // ------ ATTACK CALCULATION ------ // Base batk value is set in status_calc_misc //ROverhaul #ifndef RENEWAL // !FIXME: Weapon-type bonus (Why is the weapon_atk bonus applied to base attack?) if (sd->status.weapon < MAX_WEAPON_TYPE && sd->weapon_atk[sd->status.weapon]) base_status->batk += sd->weapon_atk[sd->status.weapon]; // Absolute modifiers from passive skills if((skill=pc_checkskill(sd,BS_HILTBINDING))>0) //Dontforgetme base_status->batk += 4; Note: I use PRERE defines but any change I make to this formular seems to have no effect at all :/
  7. hi i would like to implent some functions of the form: f(x) = Ao * q^x in order to calculate some stats. is there any way to do this in VC ?
  8. first: - im running rev 17442 got the server running smoothly so far. - client ver 2013-07-24e -> sucessfully diffed should be no problem mmo.h is also adjusted clientinfo.xml is set to version 39. but i dont think this is the cause of the problem anyway. i use the most up to date loki launcher when i try to login i receive this error message: queryNavi_Distance_Map [string "buf"]:26:attempt to index global "Navi_Distance" (a nil value)
×
×
  • Create New...