tazpanel rev 143

boot.cgi: show daemon process
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Apr 17 13:10:49 2011 +0200 (2011-04-17)
parents 0a8644c1f8a8
children 111fadde51fc
files boot.cgi
line diff
     1.1 --- a/boot.cgi	Sun Apr 17 12:20:08 2011 +0200
     1.2 +++ b/boot.cgi	Sun Apr 17 13:10:49 2011 +0200
     1.3 @@ -56,14 +56,6 @@
     1.4  		#
     1.5  		# Start and stop a daemon. I think we dont need restart since 2 
     1.6  		# clicks and you are done
     1.7 -		daemon=$(GET daemons)
     1.8 -		case "$daemon" in
     1.9 -			start=*)
    1.10 -				sleep 1
    1.11 -				/etc/init.d/${daemon#start=} start | log ;;
    1.12 -			stop=*)
    1.13 -				/etc/init.d/${daemon#stop=} stop | log ;;
    1.14 -		esac
    1.15  		. /etc/rcS.conf
    1.16  		xhtml_header
    1.17  		
    1.18 @@ -75,6 +67,18 @@
    1.19  	</p>
    1.20  </div>
    1.21  EOT
    1.22 +		daemon=$(GET daemons)
    1.23 +		case "$daemon" in
    1.24 +			start=*)
    1.25 +				sleep 1
    1.26 +				/etc/init.d/${daemon#start=} start | log ;;
    1.27 +			stop=*)
    1.28 +				/etc/init.d/${daemon#stop=} stop | log ;;
    1.29 +			pid=*)
    1.30 +				echo "<pre>"
    1.31 +				ps ww | sed "1p;/^ *${daemon#pid=} /!d"
    1.32 +				echo "</pre>" ;;
    1.33 +		esac
    1.34  		# Demon list
    1.35  		table_start
    1.36  		cat << EOT
    1.37 @@ -148,17 +152,26 @@
    1.38  			# Pidof works for many daemon
    1.39  			[ "$pid" ] || pid=`pidof $name`
    1.40  			if [ "$pid" ]; then
    1.41 -				echo "<td><img src='$IMAGES/started.png' /></td>"
    1.42 -				echo "<td><a href='$SCRIPT_NAME?daemons=stop=$name'>
    1.43 -				<img src='$IMAGES/stop.png' /></a></td>"
    1.44 -				echo "<td>$pid</td>"
    1.45 +				cat << EOT
    1.46 +<td><img src="$IMAGES/started.png" /></td>
    1.47 +<td><a href="$SCRIPT_NAME?daemons=stop=$name">
    1.48 +    <img src="$IMAGES/stop.png" /></a></td>
    1.49 +<td>
    1.50 +EOT
    1.51 +				for i in $pid; do
    1.52 +					cat << EOT
    1.53 +<a href="$SCRIPT_NAME?daemons=pid=$i">$i</a>
    1.54 +EOT
    1.55 +				done
    1.56  			else
    1.57 -				echo "<td>-</td>"
    1.58 -				echo "<td><a href='$SCRIPT_NAME?daemons=start=$name'>
    1.59 -					<img src='$IMAGES/start.png' /></a></td>"
    1.60 -				echo "<td>-----</td>"
    1.61 +				cat << EOT
    1.62 +<td>-</td>
    1.63 +<td><a href="$SCRIPT_NAME?daemons=start=$name">
    1.64 +    <img src="$IMAGES/start.png" /></a></td>
    1.65 +<td>-----
    1.66 +EOT
    1.67  			fi
    1.68 -			echo '</tr>'
    1.69 +			echo '</td></tr>'
    1.70  		done
    1.71  		table_end ;;
    1.72  	*)