tazpanel rev 551

index.cgi: add ionice support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Nov 15 14:03:03 2015 +0100 (2015-11-15)
parents 6226c660c4b6
children 04c74e2d1c20
files index.cgi tazpanel
line diff
     1.1 --- a/index.cgi	Fri Nov 13 10:38:19 2015 +0100
     1.2 +++ b/index.cgi	Sun Nov 15 14:03:03 2015 +0100
     1.3 @@ -465,6 +465,7 @@
     1.4  		[ -n "$r" ] && echo "<meta http-equiv=\"refresh\" content=\"$r\">"
     1.5  
     1.6  		[ "$(GET renice)" ] && renice $(GET renice)
     1.7 +		[ "$(GET ionice)" ] && ionice $(GET ionice)
     1.8  		[ "$(GET kill)" ] && kill $(GET kill)
     1.9  		if [ "$(GET pid)" ] && [ -d /proc/$(GET pid)/ ]; then
    1.10  			curpid=$(GET pid)
    1.11 @@ -486,18 +487,43 @@
    1.12  	<p>$(_ 'Start time:')
    1.13  		$starttime
    1.14  	</p>
    1.15 -	<p>$(_ 'Renice')[$curnice]
    1.16 +	<p>$(_ 'Renice')
    1.17  	<input type="hidden" name="top"/>
    1.18 +	<select name "renice" onchange="this.form.submit()">
    1.19  EOT
    1.20 -			values="+19 +15 +10 +5 +3 +1 0 -1 -3 -5 -10 -15 -19"
    1.21 -			[ $(id -u) -eq 0 ] || values="+19 +15 +10 +5 +3 +1"
    1.22 +			values="$(seq 20 -1 -20)"
    1.23 +			[ $(id -u) -eq 0 ] || values="$(seq 20 -1 0)"
    1.24  			for i in $values ; do
    1.25  				cat <<EOT
    1.26 -	<input type="radio" name="renice" value="$i $curpid" $([ $curnice -eq $i ] && echo checked) onchange="this.form.submit()"/>
    1.27 -	<label>$i</label>
    1.28 +	<option value="$i $curpid" $([ $curnice -eq $i ] && echo selected)>$(printf "%+d" $i)</option>
    1.29  EOT
    1.30  			done
    1.31  			cat <<EOT
    1.32 +	</select>
    1.33 +	$(_ 'I/O class')
    1.34 +	<select name="ionice" onchange="this.form.submit()">
    1.35 +EOT
    1.36 +			while read class name max; do
    1.37 +				if [ "$max" ]; then
    1.38 +					[ $(id -u) -ne 0 ] && continue
    1.39 +					for i in $(seq 0 $max); do
    1.40 +						selected="selected"
    1.41 +						[ "$(ionice $curpid)" = "$name: prio $i" ] || selected=""
    1.42 +						echo "		<option value=\"-c $class -n $i -p $curpid\" $selected>$name: prio $i</option>"
    1.43 +					done
    1.44 +				else
    1.45 +					selected="selected"
    1.46 +					[ "$(ionice $curpid)" = "$name" ] || selected=""
    1.47 +					echo "		<option value=\"-c $class -p $curpid\" $selected>$name</option>"
    1.48 +				fi
    1.49 +			done <<EOT
    1.50 +0	none
    1.51 +1	realtime	7
    1.52 +2	best-effort	7
    1.53 +3	idle
    1.54 +EOT
    1.55 +			cat <<EOT
    1.56 +	</select>
    1.57  	</p>
    1.58  </form>
    1.59  </section>
     2.1 --- a/tazpanel	Fri Nov 13 10:38:19 2015 +0100
     2.2 +++ b/tazpanel	Sun Nov 15 14:03:03 2015 +0100
     2.3 @@ -58,7 +58,7 @@
     2.4  		_n 'Starting TazPanel web server on port %d...' $HTTPD_PORT
     2.5  		$DAEMON -p $HTTPD_PORT -u root -c $HTTPD_CONF \
     2.6  			-r "$(_ 'TazPanel Authentication - Default: root:root')" &
     2.7 -		ps | grep "httpd -p $HTTPD_PORT " | grep -v grep | \
     2.8 +		ps | grep "$DAEMON -p $HTTPD_PORT " | grep -v grep | \
     2.9  			awk '{ print $1 }' > $PIDFILE
    2.10  		[ ! -f /var/lib/tazpkg/installed.info ] && tazpkg -l>/dev/null&
    2.11  		status ;;