I run openHAB on an Ubuntu server and have the following script for shutting down PCs;
#!/bin/sh
# Shutdown script
ipaddress=$1
user=$2
password=$3
net rpc shutdown --comment "Shutdown request from openHAB..." --force -I $ipaddress -U $user%$password
I call this from openHAB via the EXEC binding;
Switch NetworkPC "PC" { nh="192.168.1.25", wol="192.168.1.0#FF:FF:FF:FF:FF:FF", exec=">[OFF:/bin/sh@@-c@@/home/openhab/shutdown_pc 192.168.1.25 user password]" }
So this item has 3 bindings, 'nh' to monitor the state, i.e. determine if the PC is on/off. Then 'wol' which lets me turn the PC on via openHAB, OFF commands do nothing for 'wol'. And finally 'exec' which runs my script above and sends a shutdown RPC.
So using this item I can monitor the PC state and boot it up as well as shut it down.