styrbjorn.kladhest.se | Probably the worst blog inte world

OpenRA Start/Stop/Update script

ra-base

Here is a simple script for starting/stopping and updating OpenRA Dedicated Servers running on a Linux server.

The script depends on a .csv (comma separated value) file that defines all the OpenRA server instances that should be started.

You can add as many instances as you want by just adding rows to the instance.csv file (remember to change the name and port(s) value to unique names for each server)

Click here for more information about the OpenRA game.

/etc/init.d/openra

#!/bin/bash

CONFIG_USER="openra"
CONFIG_GROUP="games"

CONFIG_PATH_TMP="/opt/openra/temp"
CONFIG_PATH_GAME="/usr/lib/openra"
CONFIG_PATH_INSTANCE="/opt/openra/instance.csv"

#chown -R openra:games /usr/lib/openra/

# MINOR OPTIONS
SERVER_DEDICATED="True"
SERVER_DEDICATEDLOOP="True"

old_IFS=$IFS
IFS=$'\n'

SERVER_START_CMD="mono --debug OpenRA.Game.exe"

# some init stuff
chown -R openra:games /usr/lib/openra/

# STANDARD FUNCTIONS
ME=`whoami`
as_user()
{
 if [ $ME == $CONFIG_USER ] ; then
 bash -c "$1"
 else
 su $CONFIG_USER -s /bin/bash -c "$1"
 fi
}

srv_start()
{

 # Make sure the openra user owns the file structure for the game files
 chown -R ${CONFIG_USER}:${CONFIG_GROUP} /usr/lib/openra/
 chown -R ${CONFIG_USER}:${CONFIG_GROUP} ${CONFIG_PATH_INSTANCE}

 # THE SERVER INSTANCES WILL START HERE
 for INSTANCE in `cat ${CONFIG_PATH_INSTANCE} |grep -v "#"`
 do
 SERVER_NAME=`echo ${INSTANCE}| awk -F, '{ print $1 }'`
 SERVER_MODULE=`echo ${INSTANCE}| awk -F, '{ print $2 }'`
 SERVER_PORT_LISTEN=`echo ${INSTANCE}| awk -F, '{ print $3 }'`
 SERVER_PORT_EXTERNAL=`echo ${INSTANCE}| awk -F, '{ print $4 }'`
 SERVER_ADVERTISE=`echo ${INSTANCE}| awk -F, '{ print $5 }'`
 SERVER_SCREEN_NAME=`echo ${INSTANCE}| awk -F, '{ print $6 }'`

 INSTANCE_START_ARGV="Game.Mod='${SERVER_MODULE}' Server.Dedicated='${SERVER_DEDICATED}' Server.DedicatedLoop='${SERVER_DEDICATEDLOOP}' Server.Name='${SERVER_NAME}' Server.ListenPort='${SERVER_PORT_LISTEN}' Server.ExternalPort='${SERVER_PORT_EXTERNAL}' Server.AdvertiseOnline='${SERVER_ADVERTISE}'"

 if ps ax | grep -v grep | grep "${SERVER_SCREEN_NAME} ${SERVER_START_CMD}"> /dev/null
 then
 echo "OpenRA Instance ${SERVER_SCREEN_NAME} is already running, skipping start procedure"
 else
 echo "OpenRA Instance ${SERVER_SCREEN_NAME} has been started"
 as_user "cd ${CONFIG_PATH_GAME} && screen -dmS ${SERVER_SCREEN_NAME} ${SERVER_START_CMD} ${INSTANCE_START_ARGV}"
 fi
 done
}

srv_stop()
{

 for INSTANCE in `cat ${CONFIG_PATH_INSTANCE} |grep -v "#"`
 do
 SERVER_NAME=`echo ${INSTANCE}| awk -F, '{ print $1 }'`
 SERVER_MODULE=`echo ${INSTANCE}| awk -F, '{ print $2 }'`
 SERVER_PORT_LISTEN=`echo ${INSTANCE}| awk -F, '{ print $3 }'`
 SERVER_PORT_EXTERNAL=`echo ${INSTANCE}| awk -F, '{ print $4 }'`
 SERVER_ADVERTISE=`echo ${INSTANCE}| awk -F, '{ print $5 }'`
 SERVER_SCREEN_NAME=`echo ${INSTANCE}| awk -F, '{ print $6 }'`

 INSTANCE_START_ARGV="Game.Mod='${SERVER_MODULE}' Server.Dedicated='${SERVER_DEDICATED}' Server.DedicatedLoop='${SERVER_DEDICATEDLOOP}' Server.Name='${SERVER_NAME}' Server.ListenPort='${SERVER_PORT_LISTEN}' Server.ExternalPort='${SERVER_PORT_EXTERNAL}' Server.AdvertiseOnline='${SERVER_ADVERTISE}'"

 if ps ax | grep -v grep | grep "${SERVER_SCREEN_NAME} ${SERVER_START_CMD}"> /dev/null
 then
 SCREEN_PID=`ps ax | grep -v grep | grep "${SERVER_SCREEN_NAME} ${SERVER_START_CMD}"|awk '{ print $1 }'`
 echo "Stopping OpenRA instance: ${SERVER_SCREEN_NAME}"
 kill ${SCREEN_PID}
 else
 echo "OpenRA Instance ${SERVER_SCREEN_NAME} is not running, skipping stop procedure"
 fi
 as_user 'screen -wipe' > /dev/null
 done
}
srv_update()
{
 TODAY=$(date +"%Y%m%d")
 mkdir -p "${CONFIG_PATH_TMP}"
 echo "* downloading latest playtest-build"
 wget --progress=bar https://github.com/OpenRA/OpenRA/releases/download/playtest-${TODAY}/openra_playtest.${TODAY}_all.deb -O "${CONFIG_PATH_TMP}/oraupdate.deb"
 echo "* installing latest playtest-build"
 dpkg -i "${CONFIG_PATH_TMP}/oraupdate.deb"
 echo "* removing temporary installation files"
 rm -Rf "${CONFIG_PATH_TMP}"
}
srv_status()
{
 for INSTANCE in `cat ${CONFIG_PATH_INSTANCE} |grep -v "#"`
 do
 SERVER_NAME=`echo ${INSTANCE}| awk -F, '{ print $1 }'`
 SERVER_MODULE=`echo ${INSTANCE}| awk -F, '{ print $2 }'`
 SERVER_PORT_LISTEN=`echo ${INSTANCE}| awk -F, '{ print $3 }'`
 SERVER_PORT_EXTERNAL=`echo ${INSTANCE}| awk -F, '{ print $4 }'`
 SERVER_ADVERTISE=`echo ${INSTANCE}| awk -F, '{ print $5 }'`
 SERVER_SCREEN_NAME=`echo ${INSTANCE}| awk -F, '{ print $6 }'`

 INSTANCE_START_ARGV="Game.Mod='${SERVER_MODULE}' Server.Dedicated='${SERVER_DEDICATED}' Server.DedicatedLoop='${SERVER_DEDICATEDLOOP}' Server.Name='${SERVER_NAME}' Server.ListenPort='${SERVER_PORT_LISTEN}' Server.ExternalPort='${SERVER_PORT_EXTERNAL}' Server.AdvertiseOnline='${SERVER_ADVERTISE}'"

 if ps ax | grep -v grep | grep "${SERVER_SCREEN_NAME} ${SERVER_START_CMD}"> /dev/null
 then
 echo "OpenRA Instance ${SERVER_SCREEN_NAME} is running"
 else
 echo "OpenRA Instance ${SERVER_SCREEN_NAME} is not running"
 fi
 done
}

case "$1" in
 'start')
 srv_start
 ;;
 'stop')
 srv_stop
 ;;
 'restart')
 srv_stop
 srv_start
 ;;
 'status')
 srv_status
 ;;
 'update')
 srv_stop
 srv_update
 srv_start
 ;;
 *)
 echo "Usage: $0 { start | stop | restart | status | update }"
 ;;

esac

IFS=$old_IFS
exit 0

/opt/openra/instance.csv

#name,module,ListenPort,ExternalPort,Advertise,ScreenSessionName
Cinqore AB CNC [ www.cinqore.se ],cnc,1234,1234,True,openra_ded_cnc
Cinqore AB RA [ www.cinqore.se ],ra,1235,1235,True,openra_ded_ra
Cinqore AB D2K [ www.cinqore.se ],d2k,1236,1236,True,openra_ded_d2k

KVM backup script in bash

 

#!/bin/bash

usage()
{
 cat << EOF

usage: $0 options
 Author: Tommy Frössman aka. Styrbjorn
 Web Site: http://styrbjorn.kladhest.se


 -d <domain> KVM domain name (Virtual Machine)]
 -m <backup> <restore> default=backup specify backup or restore depending on situation.
 -o <full> <snap> default=full specify if backup should be taken as a snap or as a full backup.
 -l will list available backups with their timestamps for <domain>.
 -t <timestamp> specify which backup to restore using their <timestamp>
 -p </backup/path> default=script script uses variable ${FLAG_PATH} if not overrided.
 -f <true> <false> default=false forces backup/restore even if VM is running.
 -c <true> <false> default=true use gzip compression when backing up.

EOF
}

OLDIFS=$IFS
IFS=$'\n'

while getopts ":d:m:p:f:c" OPTION
do
 ARG_FOUND=1
 case $OPTION in
 h)
 usage
 exit 1
 ;;
 d)
 FLAG_DOMAIN=$OPTARG
 ;;
 m)
 FLAG_MODE=$OPTARG
 ;;
 p)
 FLAG_PATH=$OPTARG
 ;;
 f)
 FLAG_FORCE=$OPTARG
 ;;
 c)
 FLAG_GZIP=$OPTARG
 ;;
 ?)
 usage
 exit 1
 ;;
 esac
done

if [[ -z $ARG_FOUND ]]
then
 usage
fi

# IF PATH FLAG NOT PASSED SET DEFAULT BACKUP PATH
[ -z "${FLAG_PATH}" ] && FLAG_PATH="/shared/nfs_backup/KVM"

# IF DOMAIN NOT PASSED AS ARGUMENT HALT SCRIPT
[ -z "${FLAG_DOMAIN}" ] && echo "$(tput setab 4)OK$(tput sgr 0) Domain (VM) $(tput bold)is not$(tput sgr 0) specified with -d flag. Please re-run the script and pass the $(tput bold)correct arguments$(tput sgr 0)." && exit 1

# SETTING DEFAULT PARAMETERS IF NOT OVERRIDED WITH FLAGS
[ -z "${FLAG_MODE}" ] && FLAG_MODE=backup
[ -z "${FLAG_TYPE}" ] && FLAG_MODE=full
[ -z "${FLAG_FORCE}" ] && FLAG_FORCE=false
[ -z "${FLAG_GZIP}" ] && FLAG_GZIP=true

# DEFINE SOME VARIABLES
BINARY_VIRSH="/usr/bin/virsh"
BINARY_QEMUIMG="/usr/bin/qemu-img"
VIRTUAL_DISKS=""
VMDOMAIN=""

TIMESTAMP_START=`date +%Y%m%d%HH%MM`
TIMESTAMP_UNIX=`date +%s`

# HOSTNAME OF THE SERVER TO BACKUP
HOSTNAME=`hostname`

# email subject
SUBJECT="${TIMESTAMP_START} Mysql Dump Failed"

# Email To ?
EMAIL="uFgZGJXKRk42ktguNZVteGs2K82oYu@api.pushover.net"
EMAILMESSAGE="/tmp/emailmessage${TIMESTAMP_UNIX}.txt"
echo >${EMAILMESSAGE}

function DOMAIN_GETSTATE()
{

DOMAIN=$1

if [[ `${BINARY_VIRSH} list --all|grep ${DOMAIN}|wc -l` -eq 0 ]]
 then
 DOMAIN_STATE="undefined"
 else
 DOMAIN_STATE=`${BINARY_VIRSH} domstate $DOMAIN`
 fi

}
# FUNCTION TO START GUEST
function DOMAIN_ACTION_START()
{
 DOMAIN=$1

echo "$(tput setab 4)OK$(tput sgr 0) "`date +%Y-%m-%d" "%H:%M`" Starting up virtual machine ${DOMAIN}"
 ${BINARY_VIRSH} start ${DOMAIN}>/dev/null 2>&1
 sleep 1

while [[ `${BINARY_VIRSH} domstate ${DOMAIN}` != 'running' ]]
 do
 sleep 1
 echo `date +%Y-%m-%d" "%H:%M` " waiting for start to complete ${DOMAIN}"
 done
}
# FUNCTION TO SHUTDOWN GUEST
function DOMAIN_ACTION_SHUTDOWN()
{
 DOMAIN=$1

echo "$(tput setab 4)OK$(tput sgr 0) "`date +%Y-%m-%d" "%H:%M`" shutting down virtual machine ${DOMAIN}"
 ${BINARY_VIRSH} shutdown ${DOMAIN}>/dev/null 2>&1
 sleep 1

while [[ `${BINARY_VIRSH} domstate ${DOMAIN}` != 'shut off' ]]
 do
 sleep 1
 echo `date +%Y-%m-%d" "%H:%M` "waiting for shutdown to complete ${DOMAIN}"
 done
}
# FUNCTION TO PAUSE GUEST
function DOMAIN_ACTION_PAUSE()
{
 DOMAIN=$1

echo "$(tput setab 4)OK$(tput sgr 0) "`date +%Y-%m-%d" "%H:%M`" pausing virtual machine ${DOMAIN}"
 ${BINARY_VIRSH} suspend ${DOMAIN}>/dev/null 2>&1
 sleep 1

while [[ `${BINARY_VIRSH} domstate ${DOMAIN}` != 'paused' ]]
 do
 sleep 1
 echo `date +%Y-%m-%d" "%H:%M` "waiting for pause to complete ${DOMAIN}"
 done
}
# FUNCTION TO RESUME GUEST
function DOMAIN_ACTION_RESUME()
{
 DOMAIN=$1

echo "$(tput setab 4)OK$(tput sgr 0) "`date +%Y-%m-%d" "%H:%M`" resuming virtual machine ${DOMAIN}"
 ${BINARY_VIRSH} resume ${DOMAIN}>/dev/null 2>&1
 sleep 1

while [[ `${BINARY_VIRSH} domstate ${DOMAIN}` == 'paused' ]]
 do
 sleep 1
 echo `date +%Y-%m-%d" "%H:%M` "waiting for resume to complete ${DOMAIN}"
 done

}
# FUNCTION TO GET THE VOLUME GROUP AND LOGICAL VOLUME NAME WHERE THE IMAGE RESIDES
function DOMAIN_GET_FILESYSTEM()
{
 DOMAIN_PATH_DISK=$1
 LV=`df -T "${DOMAIN_PATH_DISK}" | awk '{print $1}' | tail -n1` 
 LV_NAME=`lvdisplay ${LV}|grep "LV Name"| awk '{ print $3 }'`
 VG_NAME=`lvdisplay ${LV}|grep "VG Name"| awk '{ print $3 }'`

}
# FUNCTION TO GET ALL THE DISKS ALLOCATED TO A DEFINED DOMAIN
function DOMAIN_GET_DISKS()
{
 DOMAIN_NAME=$1
 N=0
 for i in `$BINARY_VIRSH domblklist $DOMAIN_NAME | tail -n+3 | sed -e 's/^\-$//g' | awk '{print $2}'`
 do
 if [ `echo $i |grep "-"|wc -l` -eq 1 ]
 then
 continue
 else
 VIRTUAL_DISKS[$N]="$i"
 let "N= $N + 1"
 fi
 done
}
# FUNCTION TO CREATE A LVM SNAPSHOT OF THE LOGICAL VOLUME THE IMAGE RESIDES
function LVM_CREATE_SNAPSHOT()
{
 DOMAIN_NAME=$1
 mkdir -p "/tmp/lvsnap/${DOMAIN_NAME}/s${TIMESTAMP_UNIX}">/dev/null 2>&1
 lvcreate --size 5G -s -n "s${TIMESTAMP_UNIX}" "/dev/${VG_NAME}/${LV_NAME}">/dev/null 2>&1
 mount "/dev/${VG_NAME}/s${TIMESTAMP_UNIX}" "/tmp/lvsnap/${DOMAIN_NAME}/s${TIMESTAMP_UNIX}">/dev/null 2>&1
}
# FUNCTION TO DELETE THE LVM SNAPSHOT VOLUME CREATED FOR BACKUP
function LVM_DELETE_SNAPSHOT()
{
 DOMAIN_NAME=$1
 umount -f /tmp/lvsnap/${DOMAIN_NAME}/s${TIMESTAMP_UNIX}>/dev/null 2>&1
 rmdir /tmp/lvsnap/${DOMAIN_NAME}/s${TIMESTAMP_UNIX}>/dev/null 2>&1
 lvremove -f /dev/${VG_NAME}/s${TIMESTAMP_UNIX}>/dev/null 2>&1
}
# FUNCTION FOR THE ACTUAL BACKUP PROCESS
function DOMAIN_BACKUP()
{
 DOMAIN_NAME=$1
 DOMAIN_DISK_IMAGE=$2
 DOMAIN_DISK_IMAGE_STRIPPED="${DOMAIN_DISK_IMAGE##*/}"
 TIMESTAMP_BACKUP=`date +%Y%m%d_%H%M`

mkdir -p "${FLAG_PATH}/${DOMAIN}"

${BINARY_VIRSH} dumpxml "${DOMAIN_NAME}" > "${FLAG_PATH}/${DOMAIN}/${DOMAIN_DISK_IMAGE_STRIPPED:0:-4}.${TIMESTAMP_BACKUP}.xml"
 ERROR_CODE_DUMPXML=$?

#ionice -c 2 -n 7 tar -czPf "${FLAG_PATH}/${DOMAIN}/${DOMAIN_DISK_IMAGE##*/}.${TIMESTAMP_BACKUP}.tar" -C "/tmp/lvsnap/${DOMAIN_NAME}/s${TIMESTAMP_UNIX}" "${DOMAIN_DISK_IMAGE##*/}"
 nice ${BINARY_QEMUIMG} convert -p -O qcow2 -o preallocation=metadata "/tmp/lvsnap/${DOMAIN_NAME}/s${TIMESTAMP_UNIX}/${DOMAIN_DISK_IMAGE##*/}" "${FLAG_PATH}/${DOMAIN}/${DOMAIN_DISK_IMAGE_STRIPPED:0:-4}.${TIMESTAMP_BACKUP}.img"
 ERROR_CODE_TAR=$?

if [[ ${ERROR_CODE_TAR} -gt 0 ]] || [[ ${ERROR_CODE_DUMPXML} -gt 0 ]] 
 then
 rm "${FLAG_PATH}/${DOMAIN}/${DOMAIN_DISK_IMAGE_STRIPPED:0:-4}.${TIMESTAMP_BACKUP}.xml" >/dev/null 2>&1
 rm "${FLAG_PATH}/${DOMAIN}/${DOMAIN_DISK_IMAGE_STRIPPED:0:-4}.${TIMESTAMP_BACKUP}.img" >/dev/null 2>&1
 return 1
 else
 return 0
 fi
}


# HERE STARTS THE MAGIC

DOMAIN_GETSTATE ${FLAG_DOMAIN}

[ "${DOMAIN_STATE}" == "undefined" ] && echo "$(tput setab 1)ER$(tput sgr 0) "`date +%Y-%m-%d" "%H:%M` "Domain (VM) $(tput bold)is not$(tput sgr 0) defined on this hypervisor. Please re-run the script specify $(tput bold)a valid$(tput sgr 0) domain." && exit 1


DOMAIN_GET_DISKS ${FLAG_DOMAIN} # GET ALL DISKS FOR VM
DOMAIN_GET_FILESYSTEM ${VIRTUAL_DISKS[0]} # GET LV AND VG WHERE VM DISKS RESIDE

DOMAIN_ACTION_PAUSE ${FLAG_DOMAIN} # PAUSE VM
LVM_CREATE_SNAPSHOT ${FLAG_DOMAIN} ${VIRTUAL_DISKS[0]} # CREATE LVM SNAPSHOT OF LV
DOMAIN_ACTION_RESUME ${FLAG_DOMAIN} # RESUME VM

for VM_DISK in ${VIRTUAL_DISKS[@]} # TAKE BACKUP OF FILES
do
 DOMAIN_BACKUP ${FLAG_DOMAIN} ${VM_DISK}
 case $? in
 0)
 echo "$(tput setab 4)OK$(tput sgr 0) "`date +%Y-%m-%d" "%H:%M` "Disk $(tput bold)${VM_DISK##*/}$(tput sgr 0) for domain (VM) $(tput bold)${FLAG_DOMAIN}$(tput sgr 0) has $(tput bold)successfully$(tput sgr 0) been backed up."
 continue
 ;;
 *)
 echo "$(tput setab 1)ER$(tput sgr 0) "`date +%Y-%m-%d" "%H:%M` "Disk $(tput bold)${VM_DISK##*/}$(tput sgr 0) for domain (VM) $(tput bold)${FLAG_DOMAIN}$(tput sgr 0) has $(tput bold)failed$(tput sgr 0) backing up, please review system configuration."
 LVM_DELETE_SNAPSHOT ${FLAG_DOMAIN}

echo `date +%Y-%m-%d" "%H:%M`" Disk ${VM_DISK##*/} for domain (VM) ${FLAG_DOMAIN} has failed backing up, please review system configuration."> $EMAILMESSAGE
 /usr/bin/mail -s "${SUBJECT}" "${EMAIL}" < ${EMAILMESSAGE}
 exit 1
 esac
done

LVM_DELETE_SNAPSHOT ${FLAG_DOMAIN} # REMOVE LVM SNAPSHOT OF LV

# ONLY SAVE 2 BACKUPS
ls | grep .xml| sort | head -n-2 | xargs rm -f
ls | grep .img| sort | head -n-2 | xargs rm -f

IFS=$OLDIFS
rm ${EMAILMESSAGE}

 

How to create and use a GIT repository – the easy way

Git-Logo-1788C

 

GIT is a great tool for creating a code or script repository with excellent version control. GIT was originally developed by Linus Torvalds in 2005. The simplest way of using GIT is to create and manage  repositories via SSH-Keys to a *NIX based server. GIT is totally free of charge to use on your own server and extremely easy to install and configure and it’s sure worth the effort in order to keep your code or script projects up to date and backed up offsite.

The only real requirements to get a GIT repository up and running on a *NIX based server is a ssh daemon (preferable openssh) and one user for git on the server that will have all the public keys for the  clients that is going to connect and manage the repositories.

In order to get GIT up and running you must first be sure that your server has openssh-server and the base GIT package installed. The clients that are going to manage the GIT repositories will need the openssh-client and GIT base package to be installed.

First add the GIT user on the server that the clients will use to connect  and manage it’s repositories with.

 

useradd -m -s /opt/bin/git-shell git

 

Now it’s time to create an ssh-key for the client that need to manage the repository, run the following commands on your client. Just accept the default values when running the ssh-keygen command.

cd ~/.ssh/
ssh-keygen -t rsa

Now it’s time to get the ssh public key over to the server from the client, the easiest way is to transfer it to the server via SCP with your admin user on the server.

scp id_rsa.pub admin@192.168.1.xx:/tmp/id_rsa.pub

When the public key is on the server we need to add it to the GIT users authorised_keys file in order to allow you to use the ssh-key on the client. Just run the following commands on the server to apply the public key to the GIT user.

 

cat /tmp/id_rsa.pub>>~/home/git/.ssh/authorized_keys
rm /tmp/id_rsa.pub

 

 

Now it’s time to create a new repository using GIT from your client.

 

cd ~/Documents/
mkdir unix_script
cd unix_script
git init

git remote add origin git@192.168.1.xx:unix_script.git

touch README
git add README

git commit -m 'initial commit'
git push origin master

You now have a fully working repository on the server, to make clones of this repository on other clients just run the following command.

git clone git@192.168.1.xx:unix_script.git

For more information about how to manage your GIT repository see their official website.

Terraria administrationsscript för UNIX

Som ni kanske märkt har jag inte varit speciellt aktiv på min blogg dom senaste daga… året :-)

Jag kommer inte utlova några massiva uppdateringar på daglig basis då jag har fullt upp med både arbete och annat som skall göras i mitt liv men jag tänkte i alla fall försöka få bloggen att komma upp lite högre upp från graven den just nu ligger nedgrävd i.

Under några timmar här på söndagseftermiddagen har jag pillat ihop ett litet bash script för det aldeless underbara spelet Terraria som jag högst troligtvis kommer skriva några rader om senare.

Scriptet är baserat på BASH och testat på OSX men skall fungera under samtliga UNIX baserade operativsystem som MONO (Microsoft .NET Framework) är portat för.

Tanken med scriptet är att använda CRONJOBS för att schedulera uppdatering och backup av Terraria automatiskt.

Aktuell version av scriptet stödjer följande funktioner.

* Start/Stopp/Omstat.
* Backup (online/offline).
* Automatisk uppdatering av servern (servern återstartas automatiskt efter uppdateringen är färdig)
* Visa statistik från servern.
* Visa status på servern.
* Lägga servern i bakgrunden genom mjukvaran screen.
* Skicka manuella kommandon direkt till serverns konsoll.

terraria_server.sh [ originalformat]

 

#!/bin/bash
 #
 # Script name: terraria_server.sh
 # Author: Tommy Frössman
 #
 # Requirements
 # - UNIX Operating System with terminal access.
 # - BASH (Bourne Again Shell) shell available.
 # - MONO (Microsoft.NET Framework) software installed.
 # - GNU screen software installed.
 # - GNU wget software installed.
 #
 # Changelog
 # 2012-04-28
 # - install functionality.
 # - automatic configuration presets when installing.
 # - start/stop functionality.
 # - restart functionality.
 # - backup functionality (both offline and online).
 # - updating functionality.
 # - sending custom server commands functionality.
 # - show server statistics using the status server command.
 # - show running state of server.
 # - placing server engine in background using GNU Screen session.
 #
 ################# USER SETTINGS ############################

INSTALL_PATH=/opt/Terraria
 MONO_PATH=/opt/local/bin/mono
 BACKUP_PATH=/Users/Styrbjorn/Documents/Backup/Terraria
 SCREEN_PATH=/usr/bin/screen

SCREEN_SESSION_NAME="server_terraria"
 USERNAME='Styrbjorn'

############################################################

UPDATE_URL="http://update.tdsm.org/Terraria_Server.exe"
 CURRENT_USER=`whoami`
 TIMESTAMP=$(date +"%Y%m%d")

terraria_user()
 {
 if [ $CURRENT_USER == $USERNAME ]
 then
 bash -c "$1"
 else
 su - $USERNAME -c "$1"
 fi
 }
 # Function for installing latest tshock terraria server
 terraria_install()
 {
 terraria_user "mkdir -p '${INSTALL_PATH}' && touch "${INSTALL_PATH}/screenlog.0" && wget -O '${INSTALL_PATH}/Terraria_Server.exe' -q '${UPDATE_URL}'"
 terraria_user "echo 'allow-backups=True
 explosions=True
 allow-tdcmrpg=True
 always-generate-snow=False
 allowupdates=False
 backup-minutes-interval=60
 buffer-liquid-updates=False
 collect-garbage=True
 opt-numdungeons=1
 exitaccesslevel=-1
 opt-num-floating-islands=0
 generate-jungle=True
 generate-snow=True
 greeting=Welcome Minecraft Server
 hackeddata=False
 hardcore-death-action=none
 log-rotation=True
 opt-mapsize=small
 maxplayers=8
 max-respawn-time=0
 opt-maxtilesx=4200
 opt-maxtilesy=1200
 npc-cancelopendoor=False
 npcspawns-override=True
 overlimit-slots=1
 server-password=
 pid-file=
 purge-backups-after-xmins=120
 port=7777
 rejectplayeritems=
 rcon-bind-address=127.0.0.1:7023
 rcon-hash-nonce=rcon_0823922f
 opt-seed=-1
 send-queue-quota=1024
 serverip=0.0.0.0
 simple-loop=True
 spawnnpc-max=100
 stop-npc-spawning=False
 stop-updates-when-empty=True
 tile-square-messages=acceptall
 opt-usecustomtiles=False
 opt-custom-worldgen=False
 worldpath=/opt/test_terraria/Worlds/world1.wld
 //The chance that a crystal will spawn. Lower values means higher chance to spawn.
 crystal_spawn_value=110' > '${INSTALL_PATH}/server.properties'"
 }
 # terraria server upgrade function
 terraria_update()
 {
 terraria_user "cp '${INSTALL_PATH}/Terraria_Server.exe' '${INSTALL_PATH}/Terraria_Server.exe.backup' && wget -O '${INSTALL_PATH}/Terraria_Server.exe' –q '${UPDATE_URL}'"
 }
 # terraria server starting function
 terraria_start()
 {
 terraria_user "cd '${INSTALL_PATH}' && '${SCREEN_PATH}' -LdmS '${SCREEN_SESSION_NAME}' '${MONO_PATH}' Terraria_Server.exe"
 echo "Waiting until server is started"
 regex='Server started'

tail -n0 -f "${INSTALL_PATH}/screenlog.0" | while read line
 do
 if [[ $line =~ $regex ]]
 then
 pkill -9 -P $$ tail
 fi
 done
 echo Server is started
 }
 # stop terraria server
 terraria_stop()
 {
 terraria_user "'${SCREEN_PATH}' -p 0 -S '${SCREEN_SESSION_NAME}' -X eval 'stuff \"stop\"\015'"
 echo "Waiting until server is stopped"
 regex='Log end'

tail -n0 -f "${INSTALL_PATH}/screenlog.0" | while read line
 do
 if [[ $line =~ $regex ]]
 then
 pkill -9 -P $$ tail
 fi
 done

rm "${INSTALL_PATH}/screenlog.0"
 echo Server is stopped
 }
 # backup terraria server
 terraria_backup()
 {
 terraria_user "'${SCREEN_PATH}' -p 0 -S '${SCREEN_SESSION_NAME}' -X eval 'stuff \"save-all\"\015'"
 echo "Waiting until server has backed up the current map"
 regex='Saving Complete'

tail -n0 -f "${INSTALL_PATH}/screenlog.0" | while read line
 do
 if [[ $line =~ $regex ]]
 then
 pkill -9 -P $$ tail
 fi
 done
 }
 # make cold backup of terraria server when stopped
 terraria_backup_cold()
 {
 terraria_user "tar -cvf '${BACKUP_PATH}/terraria_backup_${TIMESTAMP}.tar' '${INSTALL_PATH}'>/dev/null 2>&1"
 }
 # send custom commands to terraria server
 terraria_command()
 {
 CUSTOM_COMMAND="$1";
 terraria_user "'${SCREEN_PATH}' -p 0 -S '${SCREEN_SESSION_NAME}' -X eval 'stuff \"${CUSTOM_COMMAND}\"\015'"
 }
 # check if terraria is running
 terraria_status()
 {
 terraria_user "'${SCREEN_PATH}' -p 0 -S '${SCREEN_SESSION_NAME}' -X eval 'stuff \"status\"\015'"
 terraria_user "'${SCREEN_PATH}' -p 0 -S '${SCREEN_SESSION_NAME}' -X eval 'stuff \"who\"\015'"
 tail -n0 -f "${INSTALL_PATH}/screenlog.0" | while read line
 do
 keywords=(
 'Virtual memory'
 'Total cpu usage'
 'Cpu usage last second'
 'Cpu usage last minute'
 'Last world update took'
 'NPCs'
 'online'
 )

for keyword in "${keywords[@]}"
 do
 if [[ $line =~ $keyword ]]
 then
 echo $line
 fi
 done
 pkill -9 -P $$ tail
 done
 }
 terraria_system_status()
 {
 # get terraria pid
 TERRARIA_SERVER=`ps -ef|grep -v grep|grep -ci Terraria_Server.exe`
 TERRARIA_SCREEN=`terraria_user "screen -list|grep -ic '${SCREEN_SESSION_NAME}'"`

if [ ${TERRARIA_SERVER} -ge 1 ]
 then
 if [ ${TERRARIA_SCREEN} -eq 1 ]
 then
 # server is running using this script
 return 1
 else
 # server is running not using this script (screen session not found)
 return 2
 fi
 else
 # server has not been started (server not found)
 return 0
 fi
 }
 case "$1" in
 start)
 terraria_system_status
 system_status_return=$?
 echo "* starting terraria server"

if [ "$system_status_return" -eq 1 ]
 then
 echo "- server has already been started."
 elif [ "$system_status_return" -eq 2 ]
 then
 echo "You seems to be running a Terraria server. However you do not seem to be using this script. Please shutdown your server before trying to use the script."
 elif [ "$system_status_return" -eq 0 ]
 then
 terraria_start
 fi
 ;;
 stop)
 terraria_system_status
 system_status_return=$?
 echo "* stopping terraria server"

if [ "$system_status_return" -eq 1 ]
 then
 terraria_stop
 elif [ "$system_status_return" -eq 2 ]
 then
 echo "You seems to be running a Terraria server. However you do not seem to be using this script. Please shutdown your server before trying to use the script."
 elif [ "$system_status_return" -eq 0 ]
 then
 echo "- server is not currently running."
 fi
 ;;
 restart)
 terraria_system_status
 system_status_return=$?
 echo "* restarting terraria server"

if [ "$system_status_return" -eq 1 ]
 then
 terraria_stop
 terraria_start
 elif [ "$system_status_return" -eq 2 ]
 then
 echo "You seems to be running a Terraria server. However you do not seem to be using this script. Please shutdown your server before trying to use the script."
 elif [ "$system_status_return" -eq 0 ]
 then
 echo "- server is not currently running."
 terraria_start
 fi
 ;;
 update)
 terraria_system_status
 system_status_return=$?
 echo "* updating terraria server"

if [ "$system_status_return" -eq 1 ]
 then
 terraria_stop
 terraria_update
 terraria_start
 elif [ "$system_status_return" -eq 2 ]
 then
 echo "You seems to be running a Terraria server. However you do not seem to be using this script. Please shutdown your server before trying to use the script."
 elif [ "$system_status_return" -eq 0 ]
 then
 terraria_update
 terraria_start
 fi
 ;;
 backup)
 terraria_system_status
 system_status_return=$?
 echo "* backing up server"

if [ "$system_status_return" -eq 1 ]
 then
 terraria_backup
 elif [ "$system_status_return" -eq 2 ]
 then
 echo "You seems to be running a Terraria server. However you do not seem to be using this script. Please shutdown your server before trying to use the script."
 elif [ "$system_status_return" -eq 0 ]
 then
 echo "- server is not currently running. Using offline backup instead saved to ${BACKUP_PATH}"
 terraria_backup_cold
 fi
 ;;
 status)
 terraria_system_status
 system_status_return=$?
 echo "* waiting for server status"

if [ "$system_status_return" -eq 1 ]
 then
 echo "- server is currently running."
 elif [ "$system_status_return" -eq 2 ]
 then
 echo "- You seems to be running a Terraria server. However you do not seem to be using this script. Please shutdown your server before trying to use the script."
 elif [ "$system_status_return" -eq 0 ]
 then
 echo "- server is not currently running."
 fi
 ;;
 stats)
 terraria_system_status
 system_status_return=$?
 echo "* waiting for server stats"

if [ "$system_status_return" -eq 1 ]
 then
 terraria_status
 elif [ "$system_status_return" -eq 2 ]
 then
 echo "You seems to be running a Terraria server. However you do not seem to be using this script. Please shutdown your server before trying to use the script."
 elif [ "$system_status_return" -eq 0 ]
 then
 echo "- server is not currently running."
 fi
 ;;
 install)
 terraria_system_status
 system_status_return=$?
 echo "* installing terraria server"

if [ "$system_status_return" -eq 0 ]
 then
 terraria_install
 else
 echo "- server is currently running. please stop the terraria server before reinstalling."
 fi
 ;;
 command)
 terraria_system_status
 system_status_return=$?
 echo "* sending custom command to server"

if [ "$system_status_return" -eq 1 ]
 then
 if [ $# -gt 1 ]
 then
 shift
 terraria_command "$*"
 else
 echo "Must specify server command (try 'help'?)"
 fi
 elif [ "$system_status_return" -eq 2 ]
 then
 echo "You seems to be running a Terraria server. However you do not seem to be using this script. Please shutdown your server before trying to use the script."
 elif [ "$system_status_return" -eq 0 ]
 then
 echo "- server is not currently running."
 fi
 ;;
 *)
 echo "Usage: $0 {install|start|stop|restart|update|backup|status|stats|command \"server command\"}"
 exit 1
 ;;
 esac
 exit 0

 

MySQL backup 2.0

Här kommer en hyggligt upphottad version av mitt tidigare MySQL script där jag nu implementerat en typ av timestamp backup/restore förfarande vilket tillåter dig att välja och importera olika SQL dumpar direkt via mitt script.

För mer info är det bara att köra ./mysqlbackup.sh -h :-)

mysqlbackup.sh [ originalformat]

 

#!/bin/bash

usage()
 {
 cat << EOF

usage: $0 options
 Author: Tommy Frössman aka. Styrbjorn
 Web Site: http://styrbjorn.kladhest.se

Changelog
 2011-06-06 First version of the script with the following functions.
 * Taking automatic backup of all databases on the server
 * Taking backup of a specific database only with the -d flag
 * List all available databases in the MySQL Server with the lsdb mode in the -m flag.
 * Restore database a specific dump with the -r flag along with a timestamp of the
 backup you want with the -t flag.
 * List all available backups for a specific database in the backup directory using
 -m restore -t lstimestamp along with a database supplied for the -r flag.
 * Optional -e flag for selecting a specific character encoding when doing a restore of a database.

This script is built for automatic backup of MySQL databases.

OPTIONS:
 -h Show this message
 -m Specificy what should be done (-m backup/restore/lsdb) (required)
 -d Backup this database only (-d mydatabase) (optional)
 -r Restore database (-r mydatabase) (required when using -m restore mode)
 -t Show or choose timestamp to restore database from (-t lstimestamp/timestamp) (required when using -m restore mode)
 -e Database encoding when restoring (eg. -t utf8) (optional)

EOF
 }

MODE=
 BACKUP_DB=
 RESTORE_DB=
 TAKEN_AT=
 ENCODING=

ARG_FOUND=

BWLIMIT=250
 TIMESTAMP=$(date +"%Y%m%d")

# PATH TO SAVE BACKUPS
 BACKUPDIR="/foo/bar/MySQL_backup_backupdir"

# PATH TO SAVE BACKUP-LOGS
 BACKUPLOGDIR="/foo/bar/MySQL_backup_logdir"

# HOSTNAME OF THE SERVER TO BACKUP
 HOSTNAME="myfoohostbar"

# MYSQL MY.CNF FILE PATH
 MYSQL_CNF="/foo/bar.my.cnf"

# AVAILBALE DATABASES
 LSDB=`/usr/bin/mysql --defaults-file=${MYSQL_CNF} -Bse "show databases;" | awk '{print $1}' | grep -iv ^Database$|grep -v mysql|grep -v information_schema`

# email subject
 SUBJECT="${TODAY} Mysql Dump Failed"

# Email To ?
 EMAIL="foo@bar.com"

# Email text/message
 EMAILMESSAGE="/tmp/emailmessage.txt"
 echo "${TODAY} Mysql Dump Failed ${BACKUPLOGDIR}/${HOSTNAME}.log"> $EMAILMESSAGE

if [[ -z $LSDB ]]
 then
 echo "Connection to the MySQL Server failed, aborting script!"
 echo "${TIMESTAMP} Connection to the MySQL Server failed, aborting script!"> $EMAILMESSAGE
 echo "${TIMESTAMP} Connection to the MySQL Server failed, aborting script!" >> ${BACKUPLOGDIR}/${HOSTNAME}.log
 /usr/bin/mail -s "${SUBJECT}" "${EMAIL}" < ${EMAILMESSAGE}
 exit 0
 fi

# Checking which arguments that is passed to the backupscript.
 while getopts ":h:m:d:r:t:e:" OPTION
 do
 ARG_FOUND=1

case $OPTION in
 h)
 usage
 exit 1
 ;;
 m)
 MODE=$OPTARG
 ;;
 d)
 BACKUP_DB=$OPTARG
 ;;
 r)
 RESTORE_DB=$OPTARG
 ;;
 t)
 TAKEN_AT=$OPTARG
 ;;
 e)
 ENCODING=$OPTARG
 ;;
 ?)
 usage
 exit 1
 ;;
 esac
 done

if [[ -z $ARG_FOUND ]]
 then
 usage
 fi

if [[ $MODE == 'backup' ]]
 then
 # The -m flag has been supplied with backup mode.

if [[ -n $BACKUP_DB ]]
 then
 # Checking if the specified database supplied with the -d flag exists in the MySQL Server.
 for db in $LSDB; do
 if [ "$db" = "$BACKUP_DB" ]
 then
 DB_EXISTS=1
 fi
 done

if [[ $DB_EXISTS == 1 ]]
 then
 # The specified database supplied with the -d flag was found in the MySQL Server, continuing with backup.
 # Specific database choosen so only that database will be backed up.
 echo "Only taking backup of database ${BACKUP_DB}"
 echo ${BACKUPDIR}/${TIMESTAMP}/${BACKUP_DB}.sql
 mkdir -p ${BACKUPDIR}/${TIMESTAMP}/
 mysqldump --defaults-file=${MYSQL_CNF} ${BACKUP_DB} > ${BACKUPDIR}/${TIMESTAMP}/${BACKUP_DB}.sql

if [ "$?" = 0 ];
 then
 echo "${TIMESTAMP} Mysql Dump for database ${BACKUP_DB} was Successful" >> ${BACKUPLOGDIR}/${HOSTNAME}.log
 else
 echo "${TIMESTAMP} Mysql Dump for database ${BACKUP_DB}"> $EMAILMESSAGE
 echo "${TIMESTAMP} Mysql Dump for database ${BACKUP_DB} Failed" >> ${BACKUPLOGDIR}/${HOSTNAME}.log
 /usr/bin/mail -s "${SUBJECT}" "${EMAIL}" < ${EMAILMESSAGE}
 fi
 else
 # The specified database supplied with the -d flag was not found in the MySQL Server, no backup will be made.
 echo "Backup of database failed ${BACKUP_DB} !"
 echo "The specified database could not be found on the server."
 echo "${TIMESTAMP} Mysql Dump for database ${BACKUP_DB} Failed - The specified database could not be found on the server."> $EMAILMESSAGE
 echo "${TIMESTAMP} Mysql Dump for database ${BACKUP_DB} Failed - The specified database could not be found on the server." >> ${BACKUPLOGDIR}/${HOSTNAME}.log
 /usr/bin/mail -s "${SUBJECT}" "${EMAIL}" < ${EMAILMESSAGE}
 fi
 else
 # No database has been specified in the -d argument so everything will be backed up exept the internal MySQL databases.
 echo "Taking backup of all databases on the server"
 for db in $LSDB; do
 echo ${BACKUPDIR}/${TIMESTAMP}/${db}.sql
 mkdir -p ${BACKUPDIR}/${TIMESTAMP}/
 mysqldump --defaults-file=${MYSQL_CNF} ${db} > ${BACKUPDIR}/${TIMESTAMP}/${db}.sql

if [ "$?" = 0 ];
 then
 echo "${TIMESTAMP} Mysql Dump for database ${db} was Successful" >> ${BACKUPLOGDIR}/${HOSTNAME}.log
 else
 echo "${TIMESTAMP} Mysql Dump for database ${db} Failed"> $EMAILMESSAGE
 echo "${TIMESTAMP} Mysql Dump for database ${db} Failed" >> ${BACKUPLOGDIR}/${HOSTNAME}.log
 /usr/bin/mail -s "${SUBJECT}" "${EMAIL}" < ${EMAILMESSAGE}
 fi

done
 fi
 fi

if [[ $MODE == 'restore' ]]
 then
 # The -m flag has been supplied with restore mode.

if [[ -z $RESTORE_DB ]]
 then
 # No database was choosen with the -r argument when restore mode was enabled, no restore will be made.
 echo "database to backup has not been specified"
 else
 if [[ -z $TAKEN_AT ]]
 then
 # A timestamp has not been supplied with the -t argument when trying to restore the database, no restore will be made.
 echo "Timestamp must be specified"
 else
 # Checking if the specified database supplied with the -r flag exists in the MySQL Server.
 DB_EXISTS=0
 for db in $LSDB; do
 if [ "$db" = "$RESTORE_DB" ]
 then
 DB_EXISTS=1
 fi
 done

if [[ $DB_EXISTS == 1 ]]
 then
 # The database specified in the -d flag has been found in MySQL, continuing with database restore.
 if [[ $TAKEN_AT == "lstimestamp" ]]
 then
 TIMESTAMP_CHECK=0

# Listing all available backup timestamps for the database specified with the -r flag using the lstimesstamp mode.
 for directory in ${BACKUPDIR}/*; do
 if [[ -f "${directory}/${RESTORE_DB}.sql" ]]
 then
 TIMESTAMP_CHECK=1
 echo "${directory: -8}"
 fi
 done

if [[ ${TIMESTAMP_CHECK} == 0 ]]
 then
 # The database was found in MySQL but no timestamps could be found in the backup directory, database has probably never been backed up.
 echo "Could not find any timestamps for database ${RESTORE_DB}!"
 echo "This Database has probably never been backed up before."
 fi

else
 if [[ ! -f "${BACKUPDIR}/${TAKEN_AT}/${RESTORE_DB}.sql" ]]
 then
 # The database was found in the MySQL Server but the timestamp supplied with the -t was invalid, no restore will be made.
 echo "The backup of database ${RESTORE_DB} with timestamp ${TAKEN_AT} could not be found!"
 else
 if [[ -n $ENCODING ]]
 then
 # We have supplied the -e argument with a specific encoding so we will restore the database with --default-character-set options.

# Dropping the database that is going to be restored.
 echo "* Dropping database"
 mysqladmin --defaults-file=${MYSQL_CNF} --force drop ${RESTORE_DB};

# Creating a new empty database to restore the backup to.
 echo "* Creating empty database for restore"
 mysqladmin --defaults-file=${MYSQL_CNF} --force create ${RESTORE_DB};

# Restoring the database backup to the new database.
 echo "Restoring database ${RESTORE_DB} with timestamp ${TAKEN_AT} using ${ENCODING} encoding"
 mysql --defaults-file=${MYSQL_CNF} --default-character-set=$ENCODING ${RESTORE_DB} < ${BACKUPDIR}/${TAKEN_AT}/${RESTORE_DB}.sql

else
 # No encoding has been supplied with the -e flag we are using the default MySQL encoding.

# Dropping the database that is going to be restored.
 echo "* Dropping database"
 mysqladmin --defaults-file=${MYSQL_CNF} --force drop ${RESTORE_DB};

# Creating a new empty database to restore the backup to.
 echo "* Creating empty database for restore"
 mysqladmin --defaults-file=${MYSQL_CNF} --force create ${RESTORE_DB};

# Restoring the database backup to the new database.
 echo "Restoring database ${RESTORE_DB} with timestamp ${TAKEN_AT} using standard encoding"
 mysql --defaults-file=${MYSQL_CNF} ${RESTORE_DB} < ${BACKUPDIR}/${TAKEN_AT}/${RESTORE_DB}.sql
 fi
 fi
 fi
 else
 # If the restore process fails this generic error message will be displayed.
 echo "The database $RESTORE_DB cannot be restored on this database server!"
 echo "There can be several reasons why the restore process failed"
 echo "* You are trying to restore an internal service database for MySQL server."
 echo "* You are trying to restore a database that does not exist on your system, if you want to migrate"
 echo " the database to this server please create an empty database first then try to restore it again."
 echo " To create the database in MySQL just type \"mysqladmin -u root -p create $RESTORE_DB\""
 fi
 fi
 fi

fi

if [[ $MODE == 'lsdb' ]]
 # The -m flag has been supplied with lsdb mode.
 then
 echo "Available MySQL databases on host ${HOSTNAME}"
 echo "****************************************************"
 # Listing all available databases on the MySQL server.
 echo $LSDB|tr ' ' '\n'
 fi

exit 0

För att scriptet skall fungera krävs en .my.cnf fil som specificerar databasanvändare och dess lösenord som har behörighet att dumpa data ur databasen.

Viktigt här är att sätta rätt behörighet på filen så endast din användare som kör backupscriptet har tillåtelse att läsa den.

.my.cnf

[client]
<pre> user = dbadmin
 password = dbpassword
 host = localhost

Efter detta är fixat är det bara att slänga in scriptet i ett enkelt cronjob och sen hoppas att allt sköter sig själv och du slipper få ett e-mail gällande en fallerande backup.

Crontab

0 1 * * * /foo/bar/mysqlbackup.sh >/dev/null 2>&1

Kista Alléväg

 

Efter en tids uppehåll med mycket jobbande tänkte jag ta tag i lite bloggande igen.

Jag har passat på att slänga upp en liten sida där jag kommer ladda upp nya bilder från mitt bostadsområde när det allt eftersom byggs upp och snyggas till.

Annars lunkar väl livet på i snabb takt med mycket arbete och en stressig men rolig tillvaro.

Just idag har jag inte så mycket att skriva så jag återkommer inom kort med ett vettigare inlägg :)

Cheers.

Automatisk backup av MySQL databaser

Jag hade för en tid sedan en disk-krash vilket resulterade i att jag fick lov att installera om hela servern och efter detta uppmärksamma att mina backuper av MySQL inte gått som dom skulle.

Detta resulterade i att alla gamla inlägg i min blogg försvan vilket var ytterst irriterande.

För att detta inte skulle hända igen knåpade jag ihop ett enkelt BASH script som dumpar ut samtliga av mina databaser till en .SQL fil och jag tänkte i all enkelhet dela med mig av scriptet om någon är intresserad. Read more ›

Ny tjänst, Ny lägenhet, Ny Stad.

Jag tänkte ta tillfället i akt och uppdatera bloggen lite med en del positiva saker som hänt mig och mitt liv under mitt långa uppehåll från bloggen.

Efter en ”utflykt” på arbetsmarknaden inom it-branchen på jakt efter ett nytt intressant jobb blev jag erbjuden att stanna kvar på Logica och få en helt ny tjänst och dessutom byta kontor till Nacka Strand / Stockholm. Read more ›

Superbrothers Sword & Sorcery

Jag tänkte bara ta tillfället i akt att lite snabbt tipsa mina kära läsare om ett helt superbt spel för iOS ( iPhone, iPad & iPod Touch ).

Spelet eller upplevelsen kanske man snarare skall kalla det heter Superbrothers Sword & Sorcery och är ett peka-klicka äventyrsspel.

Handlingen är kanske inte direkt spelets största hållning men musiken och dess sköna retrografik gör Superbrothers Sword & Sorcery till ett helt underbart spel att köra igenom.

Du kan köpa spelet från App Store.

Om du som jag älskade musiken i spelet kan man köpa soundtrack från spelet från iTunes Store.

 

Sony ett hopplöst fall när det gäller tjänster online

Efter ett vansinnigt långt uppehåll med mitt bloggande samt en nasty disk-krash samt trasiga databasbackuper är jag tillbaka igen.

Jag tänkte passa på att återstarta min kära blogg igen med ett ämne som säkerligen alla redan känner till. Sony’s totala haveri av Playstation Network på grund av ett hacking angrepp som skedde för en tid sedan.

Personligen har jag liksom säkert många många andra aldrig varit ett stort fan av Playstation Network, hela uppbyggnaden av funktionerna för online-spel på Playstation 3 har aldrig känts speciellt solida utan väldigt billigt intryckt i en dålig förpackning.

Trots att jag är en total fanboy av Apple och älskar UNIX i all form och därmed per automatik ogillar nästan allt vad Microsoft gör och står för så har dom tillskillnad från Sony verkligen lyckats med deras XBox Online både funktionsmässigt och hur allt hänger ihop med gränssnitt, kontaktlistor etc.

Bortsett från att jag som sagt tycker att Playstation Online är superkasst både funktions och UI mässigt så hade jag inte en susning om att säkerheten var så här usel.

Detta förvånar mig markant då jag jobbar inom IT-branchen och har i alla fall hyggliga kunskaper om hur man försöker säkra system på bästa sätt.

Det är verkligen skamligt att ett så pass stort företag som Sony faktiskt är inte har bättre säkerhet än att samtliga uppgifter om alla användare släpps ut på detta viset och att dessutom inte kunna ge något fullständigt svar på om kontokortsinformation läckt ut är helt oacceptabelt för ett företag i Sony’s position.

Frågan är nu om man kommer kunna lita på Sony igen och registrera sitt nya kontonummer i framtiden, väldigt osäkert.

 

Essentials





  • Sidor

  • Bloggstatistik


      Antal inlägg 10

      Antal kommentarer 7

      Antal taggar 49

      Antal ord: sidor 411

      Antal ord: inlägg 6,235

      Antal ord: kommentarer 192
  • Senaste kommentarer

  • Kategorier

  • Taggar

  • Google Analytics Stats

    generated by GADWP