Hello,
I've got a linux server.How can i put my workshop in srcds_run ?
Please help me , thanks.
it's my srcds file
[CODE]#!/bin/sh
#
# Copyright (c) 2004, Valve LLC. All rights reserved.
#
# a wrapper script for the main Source engine dedicated server binary.
# Performs auto-restarting of the server on crash. You can
# extend this to log crashes and more.
#
# setup the libraries, local dir first!
export LD_LIBRARY_PATH=".:bin:$LD_LIBRARY_PATH"
# The srcds_run script should be at the top level of the game tree
# Make sure we are in that directory since the script assumes this is the case
cd "`dirname \"$0\"`"
if test `id -u` -eq 0; then
echo
echo
echo "************** WARNING ***************"
echo "Running the dedicated server as root "
echo "is highly discouraged. It is generally"
echo "unnecessary to use root privileges to "
echo "execute the dedicated server. "
echo "**************************************"
echo
echo
timeout=10
while test $timeout -gt 0; do
echo -n "The server will continue to launch in $timeout seconds\r"
timeout=`expr $timeout - 1`
sleep 1
done
fi
init() {
# Initialises the various variables
# Set up the defaults
GAME=""
DEBUG=""
RESTART="yes"
HL=./srcds_linux
HL_DETECT=1
TIMEOUT=10 # time to wait after a crash (in seconds)
CRASH_DEBUG_MSG="email debug.log to linux@valvesoftware.com"
GDB="gdb" # the gdb binary to run
DEBUG_LOG="debug.log"
PID_FILE="" # only needed it DEBUG is set so init later
STEAM=""
PID_FILE_SET=0
STEAMERR=""
SIGINT_ACTION="quit 0" # exit normally on sig int
NO_TRAP=0
AUTO_UPDATE=""
STEAM_USER=""
STEAM_PASSWORD=""
STEAM_VERIFY=0
PARAMS=$*
# Remove any old default pid files
# Cant do this as they may be still running
#rm -f hlds.*.pid
# use the $FORCE environment variable if its set
if test -n "$FORCE" ; then
# Note: command line -binary will override this
HL=$FORCE
HL_DETECT=0
fi
while test $# -gt 0; do
case "$1" in
"+map")
MAP="$2"
shift;;
"-game")
GAME="$2"
shift ;;
"-debug")
DEBUG=1
# Ensure that PID_FILE is set
PID_FILE_SET=1
if test -z "$PID_FILE"; then
PID_FILE="hlds.$$.pid"
fi ;;
"-norestart")
RESTART="" ;;
"-pidfile")
PID_FILE="$2"
PID_FILE_SET=1
shift ;;
"-binary")
HL="$2"
HL_DETECT=0
shift ;;
"-timeout")
TIMEOUT="$2"
shift ;;
"-gdb")
GDB="$2"
shift ;;
"-debuglog")
DEBUG_LOG="$2"
shift ;;
"-consolelog")
CONSOLE_LOG="$2"
shift ;;
"-autoupdate")
AUTO_UPDATE="yes"
RESTART="yes" ;;
"-steamerr")
STEAMERR=1 ;;
"-ignoresigint")
SIGINT_ACTION="" ;;
"-notrap")
NO_TRAP=1 ;;
"-steambin")
STEAM=$2
shift ;;
"-steamuser")
STEAM_USER="$2";
shift ;;
"-steampass")
STEAM_PASSWORD="$2";
shift ;;
"-steamverify")
STEAM_VERIFY=1 ;;
"-help")
# quit with syntax
quit 2
;;
esac
shift
done
# Ensure we have a game specified
if test -z "$GAME"; then
GAME="tf"
PARAMS="$PARAMS -game $GAME"
fi
# Check game directory
if test ! -d "$GAME"; then
echo "ERROR: Invalid game type '$GAME' sepecified."
quit 1
fi
if test -z "$MAP"; then
echo "WARNING: No map specified! Server may not heartbeat."
fi
if test 0 -eq "$NO_TRAP"; then
# Set up the int handler
# N.B. Dont use SIGINT symbolic value
# as its just INT under ksh
trap "$SIGINT_ACTION" 2
fi
# Only detect the CPU if it hasnt been set with
# either environment or command line
if test "$HL_DETECT" -eq 1; then
detectcpu
fi
if test ! -f "$HL"; then
echo "ERROR: Source Engine binary '$HL' not found, exiting"
quit 1
elif test ! -x "$HL"; then
# Could try chmod but dont know what we will be
# chmoding so just fail.
echo "ERROR: Source engine binary '$HL' not executable, exiting"
quit 1
fi
# Setup debugging
if test -n "$DEBUG" ; then
#turn on core dumps :) (if possible)
echo "Enabling debug mode"
if test "unlimited" != `ulimit -c` && test "`ulimit -c`" -eq 0 ; then
ulimit -c 2000
fi
GDB_TEST=`$GDB -v`
if test -z "$GDB_TEST"; then
echo "WARNING: Please install gdb first."
echo " goto http://www.gnu.org/software/gdb/ "
DEBUG="" # turn off debugging cause gdb isn't installed
fi
fi
if test -n "$STEAM_PASSWORD" && test -z "$STEAM_USER"; then
echo "ERROR: You must set both the steam username and password."
quit 1
fi
HL_CMD="$HL $PARAMS"
if test -n "$CONSOLE_LOG" -a -x "bin/logger"; then
HL_CMD="bin/logger $CONSOLE_LOG $HL_CMD"
fi
}
syntax () {
# Prints script syntax
echo "Syntax:"
echo "$0 [-game <game>] [-debug] [-norestart] [-pidfile]"
echo " [-binary <binary>]"
echo " [-timeout <number>] [-gdb <gdb>] [-autoupdate]"
echo " [-steambin] [-steamerr] [-ignoresigint] [-steamuser <username>]"
echo " [-steampass <password>] [-steamverify] [-debuglog <logname>]"
echo "Params:"
echo "-game <game> Specifies the <game> to run. [Default: $DEFAULT_GAME]"
echo "-debug Run debugging on failed servers if possible."
echo "-debuglog <logname> Log debug output to this file."
echo "-consolelog <logname> Log console output to this file."
echo "-norestart Don't attempt to restart failed servers."
echo "-pidfile <pidfile> Use the specified <pidfile> to store the server pid."
echo "-binary <binary> Use the specified binary ( no auto detection ). [Default: $HL]"
echo "-timeout <number> Sleep for <number> seconds before restarting"
echo " a failed server."
echo "-gdb <gdb> Use <dbg> as the debugger of failed servers."
echo "-steambin <path> Path to steam binary."
echo "-steamerr Quit on steam update failure."
echo "-steamuser <username> Use this username for steam updates."
echo "-steampass <password> Use this password for steam updates"
echo " (-steamuser must be specified as well)."
echo "-steamverify Force steam to verify the install on updates"
echo "-ignoresigint Ignore signal INT ( prevents CTRL+C quitting"
echo " the script )."
echo "-notrap Don't use trap. This prevents automatic"
echo " removal of old lock files."
echo ""
echo "Note: All parameters specified as passed through to the server"
echo "including any not listed."
}
debugcore () {
# Debugs any core file if DEBUG is set and
# the exitcode is none 0
exitcode=$1
if test $exitcode -ne 0; then
if test -n "$DEBUG" ; then
echo "bt" > debug.cmds;
echo "info locals" >> debug.cmds;
echo "info registers" >> debug.cmds
echo "info sharedlibrary" >> debug.cmds
echo "disassemble" >> debug.cmds
echo "info frame" >> debug.cmds; # works, but gives an error... must be last
echo "----------------------------------------------" >> $DEBUG_LOG
echo "CRASH: `date`" >> $DEBUG_LOG
echo "Start Line: $HL_CMD" >> $DEBUG_LOG
# check to see if a core was dumped
if test -f core ; then
CORE="core"
elif test -f core.`cat $PID_FILE`; then
CORE=core.`cat $PID_FILE`
elif test -f "$HL.core" ; then
CORE="$HL.core"
fi
if test -n "$CORE"; then
$GDB $HL $CORE -x debug.cmds -batch >> $DEBUG_LOG
fi
echo "End of Source crash report" >> $DEBUG_LOG
echo "----------------------------------------------" >> $DEBUG_LOG
echo $CRASH_DEBUG_MSG
rm debug.cmds
else
echo "Add \"-debug\" to the $0 command line to generate a debug.log to help with solving this problem"
fi
fi
}
detectcpu() {
# Attempts to auto detect the CPU
echo "Auto detecting CPU"
if test "Linux" = `uname`; then
HL=./srcds_linux
echo "Using default binary: $HL"
elif test "FreeBSD" = `uname`; then
HL=./srcds_linux
echo "Using default binary: $HL"
elif test "Darwin" = `uname`; then
echo "Using OSX binary."
HL=./srcds_osx
else
echo "Using default binary: $HL"
fi
}
update() {
updatesingle
}
locatesteam() {
OLDPATH=${PATH}
PATH=..:.:${PATH}
STE
Why exactly do you want to put your workshop there? Are you trying to get clients to download your workshopp? If so you're doing it wrong.
[QUOTE=fappymcfap;51578690]Why exactly do you want to put your workshop there? Are you trying to get clients to download your workshopp? If so you're doing it wrong.[/QUOTE]
I want to download all addons automatically to server
You can't and you don't have to.
[url]https://wiki.garrysmod.com/page/Workshop_for_Dedicated_Servers[/url]
[QUOTE=xDShot;51579174]You can't and you don't have to.
[url]https://wiki.garrysmod.com/page/Workshop_for_Dedicated_Servers[/url][/QUOTE]
How to Run it ? I can't access linux.I can access only server files
[QUOTE=Avio;51579245]How to Run it ? I can't access linux.I can access only server files[/QUOTE]
Follow the link xd sent. After that make a lua file under lua/autorun/server
In it you'll do the following:
[CODE]resource.AddWorkshop( "191834918" ) -- The number represents the workshop Id
/* I reccomend adding commentary after a line
just so it looks more organized and you can
tell which addon is which
*/
resource.AddWorkshop( "134134134" ) -- Ex: TTT Commands
resource.AddWorkshop( "123134134" ) -- Some Player Model[/CODE]
[QUOTE=Avio;51579245]How to Run it ? I can't access linux.I can access only server files[/QUOTE]
[QUOTE=fappymcfap;51579729]Follow the link xd sent. After that make a lua file under lua/autorun/server
In it you'll do the following:
[CODE]resource.AddWorkshop( "191834918" ) -- The number represents the workshop Id
/* I reccomend adding commentary after a line
just so it looks more organized and you can
tell which addon is which
*/
resource.AddWorkshop( "134134134" ) -- Ex: TTT Commands
resource.AddWorkshop( "123134134" ) -- Some Player Model[/CODE][/QUOTE]
i have srcds_run and srcds_linux
i added lua file
Extract the addons .gma file then upload the addons manually
You can use resource.AddWorkshop to make clients download the content (if any).
[QUOTE=Moku;51581166]Extract the addons .gma file then upload the addons manually
You can use resource.AddWorkshop to make clients download the content (if any).[/QUOTE]
How can i download addons to my server ? (Automatically)
My upload speed is slow
[QUOTE=Avio;51581266]How can i download addons to my server ? (Automatically)
My upload speed is slow[/QUOTE]
Look at my other post. I told you exactly what to do, you don't touch srcds_run at all
You can tell your [i]server[/i] to mount and refer to a collection of workshop addons by adding the collection ID on the command line of the server.
[url]https://wiki.garrysmod.com/page/Workshop_for_Dedicated_Servers[/url]
You can tell the [i]client[/i] to download those addon automatically by using resource.AddWorkshop("idnumber") in Lua (server-side).
[QUOTE=ph:lxyz;51583716]You can tell your [i]server[/i] to mount and refer to a collection of workshop addons by adding the collection ID on the command line of the server.
[url]https://wiki.garrysmod.com/page/Workshop_for_Dedicated_Servers[/url]
You can tell the [i]client[/i] to download those addon automatically by using resource.AddWorkshop("idnumber") in Lua (server-side).[/QUOTE]
i asked it.how can i do this
[QUOTE=Avio;51585356]i asked it.how can i do this[/QUOTE]
This can be achieved by placing a line of text in the file "init.lua".
That line of text is comprised of a set of letters. The letters you need are:
r, e, s, o, u, r, c, e, ., A, d, d, W, o, r, k, s, h, o, p, (, ", ", ).
Between the two '"' characters, you need to write the ID number of the Workshop Addon. You can find this in Steam by showing the URL when you are viewing the information about the addon you want to include.
I hope this leaves little confusion.
Sorry, you need to Log In to post a reply to this thread.