tazpanel rev 530

index.cgi: add renice support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Aug 28 13:08:26 2015 +0200 (2015-08-28)
parents 528e24253970
children ac5b7a1e8448
files index.cgi
line diff
     1.1 --- a/index.cgi	Wed Aug 26 13:15:14 2015 +0300
     1.2 +++ b/index.cgi	Fri Aug 28 13:08:26 2015 +0200
     1.3 @@ -462,8 +462,34 @@
     1.4  EOT
     1.5  		[ -n "$r" ] && echo "<meta http-equiv=\"refresh\" content=\"$r\">"
     1.6  
     1.7 +		[ "$(GET renice)" ] && renice $(GET renice)
     1.8 +		if [ "$(GET pid)" ]; then
     1.9 +			cat <<EOT
    1.10 +<section>
    1.11 +<p>
    1.12 +$(ps auxww | sed "/^ *$(GET pid) /!d")
    1.13 +</p>
    1.14 +<form>
    1.15 +	<p>$(_ 'Renice:')
    1.16 +	<input type="hidden" name="top"/>
    1.17 +EOT
    1.18 +			values="+19 +10 +5 +1 -1 -5 -10 -19"
    1.19 +			[ $(id -u) -eq 0 ] || values="+19 +10 +5 +1"
    1.20 +			for i in $values ; do
    1.21 +				cat <<EOT
    1.22 +	<input type="radio" name="renice" value="+19 $(GET pid)" onchange="this.form.submit()"/>
    1.23 +	<label>$i</label>
    1.24 +EOT
    1.25 +			done
    1.26 +			cat <<EOT
    1.27 +	</p>
    1.28 +</form>
    1.29 +</section>
    1.30 +EOT
    1.31 +		fi
    1.32  		echo '<section><div><pre class="term log">'
    1.33 -		top -n1 -b | htmlize | sed \
    1.34 +		busybox top -n1 -b | htmlize | sed \
    1.35 +			-e 's|^\( *\)\([0-9][0-9]*\)|\1<a href="?top\&amp;pid=\2">\2</a>|' \
    1.36  			-e 's|^[A-Z].*:|<span class="color1 color31">\0</span>|g' \
    1.37  			-e 's|^\ *PID|<span class="color1 color32">\0</span>|g'
    1.38  		echo '</pre></div></section>' ;;