Friday, March 15, 2013

Going out for the weekend, need to idle. Script + contrab to the rescue!

Just a quick update on the TF2 Idling for Linux project, I haven't done much due to real life expectations. However I whipped up a quick shell script to run idle accounts quickly. Since I'm going out for the weekend, I just setup contrab to run my accounts at specific times. Hopfully this script will be of use to others.


#!/bin/bash
# Start an idle account
clear
echo "*******************************************"
echo "* TF2 Idle Start                          *"
echo "* Valid Accounts: 1-5                     *"
echo "*                                         *"
echo "*******************************************"
case $1 in
1) rm /home/cyhawk/.steam/steam.pid && nice -n 20 sudo arkose -h --device /dev/nvidiactl --device /dev/nvidia0 "steam -login login password1 -applaunch 440 -nomouse -textmode -nosound -low -novid -nopreload -noipx -nojoy -sw +sv_lan 1 -maxplayers 2 +map itemtest" ;;
2) rm /home/cyhawk/.steam/steam.pid && nice -n 20 sudo arkose -h --device /dev/nvidiactl --device /dev/nvidia0 "steam -login login password2 -applaunch 440 -nomouse -textmode -nosound -low -novid -nopreload -noipx -nojoy -sw +sv_lan 1 -maxplayers 2 +map itemtest" ;;
3) rm /home/cyhawk/.steam/steam.pid && nice -n 20 sudo arkose -h --device /dev/nvidiactl --device /dev/nvidia0 "steam -login login password3 -applaunch 440 -nomouse -textmode -nosound -low -novid -nopreload -noipx -nojoy -sw +sv_lan 1 -maxplayers 2 +map itemtest" ;;
4) rm /home/cyhawk/.steam/steam.pid && nice -n 20 sudo arkose -h --device /dev/nvidiactl --device /dev/nvidia0 "steam -login login password4 -applaunch 440 -nomouse -textmode -nosound -low -novid -nopreload -noipx -nojoy -sw +sv_lan 1 -maxplayers 2 +map itemtest" ;;
5) rm /home/cyhawk/.steam/steam.pid && nice -n 20 sudo arkose -h --device /dev/nvidiactl --device /dev/nvidia0 "steam -login login password5 -applaunch 440 -nomouse -textmode -nosound -low -novid -nopreload -noipx -nojoy -sw +sv_lan 1 -maxplayers 2 +map itemtest" ;;
S) su -l tf2server ;;
z) exit 0 ;;
*) echo "Invalid response. Exiting";
esac

My end goal is to have this script setup to automate running the hlds (restarting once a week) and starting and stopping idle accounts. Or perhaps a more user friendly interface, who the hell knows at this point. I'm just happy I can finish idling up this week. Don't forget to fix the paths and add in your username/passwords. Also to run this without the sudo password, you'll have to add arkose to the sudoers file:

sudo nano /etc/sudoers
Under: # User privilege specification, add
cyhawk  ALL=NOPASSWD : /usr/bin/arkose

change your username of course. Is this secure? I doubt it, but the machine I idle on isn't very secure to begin with.



I've also noticed memory usage for TF2 in -textmode can be quite varied. I've seen as low as 240mb and as high as 1.7gb. I have no idea why this is, or what resources it could possibly want to balloon up that far. I believe the answer to this will be to run a dedicated server locally and connect to it to combat the high memory usage. The HLDS doesn't use much and if you aren't running as a server memory usage drops down to 200-500mb which is quite acceptable. This should allow scaling of multiple idle accounts much easier. We'll see how this goes (hlds is currently updating again, i'll have results sometime next week)



2 comments:

  1. Thank you, I use your script with a few modifications for idling (I deleted the arkose part, because that did not work with my intel card, neither steam-lxc). I also added ionice -c3 so the disk io will be in low priority too

    ReplyDelete