# Here's an example of how to start bash as a coprocess from powerman # and get it to execute commands for you. powerman.conf should contain: # # include "/etc/powerman/bashfun.dev" # device "bf0" "bashfun" "/bin/bash |&" # node "b1" "bf0" "1" # specification "bashfun" { timeout 5 plug name { "1" } script login { send "export PS1='Pm>'\n" expect "Pm>" send "PLUG_STATE=off\n" expect "Pm>" } script status { send "echo $PLUG_STATE\n" expect "(off|on)" setplugstate "1" $1 on="on" off="off" expect "Pm>" } script on { send "PLUG_STATE=on\n" expect "Pm>" } script off { send "PLUG_STATE=off\n" expect "Pm>" } }