Recent Changes - Search:

Bob Brandt

Linux Projects


Server Projects

Desktop Projects

Novell Projects


VMware Projects


N900 (Maemo) Projects


Python Projects


OpenOffice.org Projects


Other Projects


PmWiki

edit SideBar

Vuse init.d Control Script

Other.Vuse History

Hide minor edits - Show changes to markup

February 13, 2010, at 06:51 PM by 217.75.11.41 -
Changed lines 10-136 from:
to:
  1. !/usr/bin/env bash
  2. #
  3. Vuse (projects@brandt.ie) #
  4. #
  5. This script launches the Vuse BitTorrent Client on boot. #
  6. #
    1. BEGIN INIT INFO
  7. Provides: Vuse
  8. Required-Start: $local_fs $remote_fs $syslog $network
  9. Should-Start:
  10. Required-Stop: $local_fs $remote_fs $syslog $network
  11. Should-Stop:
  12. Default-Start: 3 5
  13. Default-Stop: 0 1 2 6
  14. Short-Description: Vuse BitTorrent Client.
  15. Description: Vuse BitTorrent Client
    1. END INIT INFO
  16. Check for existence of the rc script

RCSCRIPT=/usr/bin/rcvuse test -x $RCSCRIPT || ln -fs /etc/init.d/vuse $RCSCRIPT

  1. Check for existence of needed binary file

VUSE_BIN=/opt/azureus/azureus test -r $VUSE_BIN || { echo "$VUSE_BIN not existing";

	if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }

VUSE_USER=bob id $VUSE_USER > /dev/null 2> /dev/null || { echo "$VUSE_USER user doesn't exist";

	if [ "$1" = "stop" ]; then exit 0;
	else exit 4; fi; }

USER_PARAM= [ `id -u` == 0 ] && USER_PARAM="-u $VUSE_USER "

VUSE_OPTIONS='' VUSE_MONITOR_TIMEOUT=2h

. /etc/rc.status rc_reset

  1. Return values acc. to LSB for all commands but status:
  2. 0 - success
  3. 1 - generic or unspecified error
  4. 2 - invalid or excess argument(s)
  5. 3 - unimplemented feature (e.g. "reload")
  6. 4 - user had insufficient privileges
  7. 5 - program is not installed
  8. 6 - program is not configured
  9. 7 - program is not running
  10. 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
  11. Note that starting an already running service, stopping
  12. or restarting a not-running service as well as the restart
  13. with force-reload (in case signaling is not supported) are
  14. considered a success.

case "$1" in

    start)
	echo -n "Starting Vuse "
	/sbin/startproc $USER_PARAM$VUSE_BIN $VUSE_OPTIONS

	# Remember status and be verbose
	rc_status -v
	;;
    stop)
	echo -n "Shutting down Vuse "
	/sbin/killproc -TERM $VUSE_BIN

	# Remember status and be verbose
	rc_status -v
	;;
    try-restart|condrestart)
	if test "$1" = "condrestart"; then
		echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
	fi
	$0 status
	if test $? = 0; then
		$0 restart
	else
		rc_reset	# Not running is not a failure.
	fi
	# Remember status and be quiet
	rc_status
	;;
    restart)
	## Stop the service and regardless of whether it was
	## running or not, start it again.
	$0 stop
	$0 start

	# Remember status and be quiet
	rc_status
	;;
    status)
	echo -n "Checking for service Vuse "
	/sbin/checkproc $VUSE_BIN
	# Remember status and be verbose
	rc_status -v
	;;
    monitor)
	echo "Starting Monitoring of the Vuse service. Timeout = $VUSE_MONITOR_TIMEOUT"
	$0 start-sleep

	# Remember status and be quiet
	rc_status
	;;	
    start-sleep)
	echo "Starting Monitoring of the Vuse service. Timeout = $VUSE_MONITOR_TIMEOUT"

	if ! $0 status ; then
		$0 start
		sleep $VUSE_MONITOR_TIMEOUT && $0 start-sleep &
	fi

	# Remember status and be quiet
	rc_status
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|monitor)"
	exit 1
	;;

esac rc_exit

February 13, 2010, at 06:24 PM by 217.75.11.41 -
Added lines 1-13:

(:title Vuse init.d Control Script:)

Vuse (Azureus) is a bit torrent client.

This init.d script allows the user to stop/start the application on boot, but can also start a process where it launches every so often to make sure that the application is running.

/etc/init.d/vuse

(:div style="border-style:ridge; border-width:2px; background-color:#ffffcc; margin-left:50px; overflow:auto; width:650px; height:500px;":)


(:divend:)

Edit - History - Print - Recent Changes - Search
Page last modified on February 13, 2010, at 06:51 PM