Forum

Results 1 to 4 of 4
  1. #1
    Join Date
    June 2007
    Location
    in a house.
    Posts
    98

    [outdated] Knifty startup script xD

    Edit by mod
    Please don't use this outdated script anymore! The script got an overhaul long time ago.
    Please use the minimal or startscript instead


    Ok, the forum has no options for file atachments.
    so, i put it here.
    rewrote my generic startup script.
    hope you guys can use it.

    #! /bin/bash
    # Copyright (c) 2009 spatieman
    # Startup script with variables
    # Abusing this script is at own risk.
    #
    clear
    server_name="TeamSpeak 3" # Put here your services name
    program_pid="teamspeak3.pid" # Put here a name for the PID file
    program_path="/var/www/path/to/your/teamspeak3-server_linux-amd64/" # FULL path to aplication directory
    program_startup="./ts3server_linux_amd64" # Service name for executing
    program_name="ts3server_linux_amd64" # Service name used in script
    command_line="create_default_virtualserver=0 default_voice_port=9987 createinifile=1 inifile=ts3server.ini " # Aditional stuff if a program needs it

    # below line used when started over HTML interface xD
    #cd $program_path
    #
    echo Current service: $server_name
    echo Program PID: $program_pid
    echo Program path: $program_path
    echo Program executable: $program_startup
    echo Program name: $program_name
    echo program preferences: $command_line
    #echo the CD path: cd $program_path
    echo " "
    sleep 1

    case "$1" in
    help)
    echo $server_name "help file"
    echo " "
    echo "./start_TS3 help :This page"
    echo "./start_ts3 start :Starts the" $server_name
    echo "./start_ts3 stop :Stops the" $server_name
    echo "./start_ts3 restart :Restarts the" $server_name
    echo "./start_ts3 status :Checks the status for" $server_name
    echo " "
    echo "This script works as it is, you may add,remove, edit, modify (Or not use it al all)"
    echo " "
    exit 1
    ;;
    start)
    activeid=`ps -C $program_name -o pid=`
    if [ $activeid ]; then
    echo $server_name "already started ?";
    echo "use ./start_TS3 status incase your not shure"
    echo " "
    exit 1
    else
    if [ "$UID" = "0" ]; then
    echo WARNING ! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT
    for c in $(seq 1 10); do
    echo -n "!"
    done
    echo !
    fi
    echo "starting the" $server_name "server now"
    if [ -e $program_name ]; then
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. $program_startup $command_line &
    echo $server_name "server started"
    echo $?
    exit 0
    fi
    fi
    ;;
    stop)
    activeid=`ps -C $program_name -o pid=`
    if [ $activeid ]; then
    echo "Stoping" $server_name "now"
    kill $activeid
    exit 1
    else
    echo "No running" $server_name
    exit 0
    fi
    ;;
    restart)
    activeid=`ps -C $program_name -o pid=`
    if [ $activeid ]; then
    echo "restarting the" $server_name "server now"
    sleep 2
    $0 stop
    sleep 2
    $0 start || exit 1
    else
    echo "restarting the" $server_name "server is not possible, seems not to be running, please use ./start_TS3 start"
    exit 0
    fi
    ;; status)
    echo "Checking "$server_name "server status"
    activeid=`ps -C $program_name -o pid=`
    if [ $activeid ]; then
    echo "Status: Running" $server_name
    else
    echo "Status: NO running" $server_name

    fi
    exit 0

    ;;

    *)
    echo "Usage: $0 {help|start|stop|restart|status}"
    exit 2
    esac
    exit 0
    Last edited by florian_fr40; November 8th, 2011 at 03:32 PM.

  2. #2
    Join Date
    June 2007
    Location
    in a house.
    Posts
    98
    woops..
    seems that the restart function was bugging.,
    fixed

  3. #3
    speeker Guest
    Want to make it a complete guide by also putting in the auto start on?
    The 755 permission to execute in init.d and the chkconfig teamspeak3.
    The chkconfig --level 2345 teamspeak3 on isn't working though.


    And on fedora10 it isn't working either..
    Last edited by speeker; December 20th, 2009 at 09:18 PM.

  4. #4
    Join Date
    June 2007
    Location
    in a house.
    Posts
    98
    no.
    works not as started on root..
    i also now made a HTML stuff, so it can be managed over a browser to.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Startup script
    By Sandbird in forum Linux / FreeBSD
    Replies: 2
    Last Post: September 9th, 2013, 11:10 AM
  2. Replies: 2
    Last Post: December 21st, 2009, 08:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •