Teamspeak start stop script

After my server was restarted twice by my hosting center I decided to make sure Teamspeak would start automatically. I read a few posts on how other people did it but in the end I decided that I created my own minimal script.

My two goals with this init script was:

Init script (/etc/init.d/teamspeak):

#!/bin/sh

TEAMSPEAK_DIR=/usr/local/teamspeak
TEAMSPEAK_USER=teamspeak

# Make sure that Teamspeak starts even though it wasn't closed nicely last time (ie. by a power cut)
if [ $(su - $TEAMSPEAK_USER -c "ps ux" |grep tsserver2.pid|grep -v grep|wc -l) -eq 0 ] && [ -f ${TEAMSPEAK_DIR}/tsserver2.pid ]
then
    rm ${TEAMSPEAK_DIR}/tsserver2.pid
fi

cd ${TEAMSPEAK_DIR}
su - $TEAMSPEAK_USER -c "./teamspeak2-server_startscript $1"
cd -