webif/var/mongoose/include/services.jim

29 lines
654 B
Plaintext
Raw Normal View History

#!/mod/bin/jimsh
set services [split [exec /mod/bin/service mlist]]
foreach service $services {
set data [split $service ":"]
set name [lindex $data 0]
set installed [lindex $data 1]
set auto [lindex $data 2]
set running [lindex $data 3]
puts "<tr><td class=even>$name</td>"
if (!$installed) {
puts "<td colspan=3><i>Not installed</i></td></tr>"
continue
}
puts -nonewline "<td><input type=checkbox class=auto name=\"$name\""
if ($auto) { puts -nonewline " checked" }
puts "></td>"
puts -nonewline "<td><input type=checkbox class=toggle name=\"$name\"""
if ($running) { puts -nonewline " checked" }
puts "></td>"
puts "</tr>"
}