[UNIX]Server doesn't receiving anything from pipe.

Discussion in 'Bukkit Help' started by BlackCore, May 5, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    BlackCore

    So,i used hmod,and everything was fine,i writed some of .sh scripts for server administration.
    But after CB i've got an issue.Server doesn't receiving anything from pipe.I have output from server,but can't send anything to it.
    There is some of my sh scripts.(mandriva 2010.0)
    server_nogui.sh(server launch)
    Code:
    #!/bin/sh
    /usr/local/jre1.6.0_23/bin/java -server -Xms1024M -Xmx1024M -XX:+UseFastAccessorMethods -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:ParallelGCThreads=2 -XX:+CMSIncrementalPacing -XX:+UseAdaptiveGCBoundary -XX:SurvivorRatio=10 -XX:NewRatio=4 -XX:UseSSE=3 -jar craftbukkit.jar nogui
    minecraftc.sh(console input)
    Code:
    #!/bin/bash
    cd /mnt/data/Minecraft/bin/
    if [ -z "$1" ];
    then
        lck="/var/lock/subsys/minecraftc"
    else
        lck="$1";
    fi;
    #mknod /tmp/minecraftdlog p;
    #tail -f ./minecraftd.log > /tmp/minecraftdlog &
    #while [ -f "$lck" ]; do
    #    nc -l -p 60123 -v -q 1 -w 1 </tmp/minecraftdlog 2>>./minecraftc.log | tee -a ./minecraftc.log >./pipe;
    #    echo "==== console died ==== `date` ====" >> ./minecraftc.log;
    #    sleep 1;
    #done;
    #rm /tmp/minecraftdlog;
    #echo "==== console script ended ==== `date` ====" >> ./minecraftc.log
    #exit 0;
    ####===========
    tail -f ./minecraftd.log | (while [ -f "$lck" ]; do
        sleep 1;
        nc -l -p 60123 -v 2>> ./minecraftc.log | tee -a ./minecraftc.log
        echo "==== console died ==== `date` ====" >> ./minecraftc.log
        done) > ./pipe;
    echo "==== console script ended ==== `date` ====" >> ./minecraftc.log
    
    minecraftd.sh(console output)
    Code:
    #!/bin/bash
    cd /mnt/data/Minecraft/bin/
    if [ -z "$1" ];
    then
    	lck="/var/lock/subsys/minecraftd"
    else
    	lck="$1";
    fi;
    #while [ -f "$lck" ]; do
    #	cat ./pipe | ./server_nogui.sh >> ./minecraftd.log 2>&1;
    #	sleep 1;
    #	echo "==== server died ==== `date` ====" >> ./minecraftd.log;
    #done;
    #echo "==== script ended ==== `date` ====" >> ./minecraftd.log;
    #exit 0;
    
    cat ./pipe | (while [ -f "$lck" ]; do
    	sleep 1;
    	./server_nogui.sh >> ./minecraftd.log 2>&1;
    	echo "==== server died ==== `date` ====" >> ./minecraftd.log
    	done);
    echo "==== script ended ==== `date` ====" >> ./minecraftd.log
    
    /etc/init.d/minecraft(fancy "launch everything!" script)
    Code:
    #!/bin/sh
    # Minecraft     This shell script takes care of starting and stopping
    #               Minecraft.
    #
    # chkconfig: 2345 67 32
    # description: Minecaft provides support for updating dynamic DNS services.lol:D
    
    . /etc/rc.d/init.d/functions
    
    program1="minecraftd";
    program2="minecraftc";
    subsys1="/var/lock/subsys/$program1";
    subsys2="/var/lock/subsys/$program2";
    #pidf1="/var/run/$program1.pid";
    #pidf2="/var/run/$program2.pid";
    bin1="/mnt/data/Minecraft/bin/minecraftd.sh";
    bin2="/mnt/data/Minecraft/bin/minecraftc.sh";
    #bin="/mnt/data/Minecraft/bin/server_nogui.sh > /tmp/mc 2>&1 &"
    
    # See how we were called.
    case "$1" in
      start)
            # Start daemon.
            echo -n "Starting $program1: "
            touch $subsys1
            daemon --user user --pidfile $program1 +10 "$bin1 $subsys1 &"
            #echo $! > $pidf1
            echo_success;
            echo
            # Start console.
            echo -n "Starting $program2: "
            touch $subsys2
            #chown user $subsys2
            daemon --user user --pidfile $program2 +10 "$bin2 $subsys2 &"
            #echo $! > $pidf2
            echo_success;
            echo
            #sleep 1;
            #pidof "java" > $pidf1;
            #pidof "nc" > $pidf2;
            ;;
      stop)
            echo stop > /mnt/data/Minecraft/bin/pipe #notify
            # Stop daemon.
            echo -n "Shutting down $program1: "
            #pid1=`cat $pidf1`;
            #[ -n "$pid1" ] && kill $pid1
            rm -f $subsys1 #$pidf1
            #killproc java
            echo_success;
            echo
            # Stop console.
            echo -n "Shutting down $program2: "
            #pid2=`cat $pidf2`;
            #[ -n "$pid2" ] && kill $pid2
            rm -f $subsys2 #$pidf2
            #killproc -p /var/run/$program2.pid $program2
            echo_success;
            echo
            rm -f $subsys2
            ps uxa | egrep '(nc -l|inecraft|java)' | grep -v 'grep' | cut -b 10-15 | xargs kill #rude hack
            ;;
      restart)
            $0 stop
            $0 start
            ;;
      status)
            status -p /var/run/$program1.pid $program1
            status -p /var/run/$program2.pid $program2
            ;;
      *)
            echo "Usage: $0 {start|stop|restart|status}"
            exit 1
    esac
    
    exit 0
    
    So,what's wrong?D:
    Using CB since 684 and even now.
    p.s. sorry if i missed with forum.

    "-Djline.terminal=jline.UnsupportedTerminal"
    So,this is flag,that removes that fancy umh...">" symbol?:D


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 15, 2016
  2. Offline

    TnT

    Try this command instead:
    Code:
    #!/bin/sh
    java -Xincgc -Xmx1G -Djline.terminal=jline.UnsupportedTerminal -jar craftbukkit.jar nogui
    
    Yes, the -Djline.terminal=jline.UnsupportedTerminal will strip out the > from the screen.

    I also stripped out most of those Java flags, because you really don't need them for the amount of RAM you allocated, but you get the point of the command if you wish to use your old flags still.
     
  3. Offline

    BlackCore

    Naah,i'm thinking about clearing my launch script,but i'm too lazy sometimes.Anyways,thx for help,and sorry for my dumbness.A bit later i found that flag in evilseph's post about this fancy ">".
    Edit:Lolwut?
    I used that flag,> doesn't hided,but now everything is working.WTF?
    Edit2:Aw...Lol,i'm so dumb today.
     
Thread Status:
Not open for further replies.

Share This Page