Ever wish you can run utorrent as a service?

I.E.

sudo service utorrent start
sudo service utorrent stop
sudo service utorrent status
sudo service utorrent restart
sudo service utorrent log

I wanted the same thing so I searched for a script.

!/bin/sh # # uTorrent start stop service script # # copy to /etc/init.d # run "update-rc.d utorrent defaults" to install # run "update-rc.d utorrent remove" to remove # # @author FanFan Huang ([email protected]) # # # BEGIN CONFIGURATION SECTION #################################### # Path where you want store the log file # (default recommended) LOGFILE=/var/log/utorrent.log # Path for the PID file where the process id is stored # (default is for debian and ubuntu systems) PIDFILE=/var/run/utorrent.pid # Path were you extracted utorrent server UTORRENT_PATH=/home/vortex-5/shared/utorrent/utorrent-server-v3_0 # Nice value NICE=15 # END CONFIGURATION SECTION ##################################### uTorrentServer() { nice -n $NICE $UTORRENT_PATH/utserver -settingspath $UTORRENT_PATH -daemon -logfile $1 -pidfile $2 } case "$1" in start) if [ -e "$PIDFILE" ]; then echo "uTorrent is already running please terminate first" else echo "uTorrent starting" uTorrentServer $LOGFILE $PIDFILE while [ ! -e $LOGFILE ]; do sleep 1 #Wait for file to be generated done while [ "" = "$(cat $LOGFILE|grep 'IPv6 is installed')" ]; do #wait until utorrent has finished bootup echo -n ".$(cat $LOGFILE|grep 'IPv6 is installed')" sleep 1 done RESULT=$(cat $LOGFILE|grep 'bind failed') if [ -n "$RESULT" ]; then echo "Port bind failure detected uTorrent may have limited functionality" else echo "uTorrent started successfully" fi fi ;; stop) if [ -e "$PIDFILE" ]; then echo -n "uTorrent is shutting down" PID=$(cat $PIDFILE) kill $PID while [ -n "$(pidof "utserver")" ]; do echo -n "." sleep 1 done echo "uTorrent Service Terminated" rm $PIDFILE rm $LOGFILE else echo "Service is not currently running!" fi ;; status) if [ -e "$PIDFILE" ]; then PID=$(cat $PIDFILE) echo "uTorrent running pid: $PID" else echo "uTorrent not running" fi ;; restart) $0 stop $0 start ;; log) if [ -e "$LOGFILE" ]; then LOG=$(cat $LOGFILE) echo "$LOG" else echo "uTorrent is not running no active log file" fi ;; *) echo "Usage {start|stop|restart|status|log}" exit esac exit 0