Update usage
This commit is contained in:
@@ -1,13 +1,41 @@
|
|||||||
# Wolz
|
# Wolz
|
||||||
|
|
||||||
- Broadcast Wake on Lan (WoL) magic packet to network devices in the local network.
|
- Wake up or shutdown a device on the local network
|
||||||
|
- Broadcast Wake on Lan (WoL) magic packet to wake up.
|
||||||
- WoL only works if the target network interface supports it and is not in low power mode.
|
- WoL only works if the target network interface supports it and is not in low power mode.
|
||||||
- Check [arch wiki](https://wiki.archlinux.org/title/Wake-on-LAN) on this subject to setup your device to Wakup on LAN.
|
- Check [arch wiki](https://wiki.archlinux.org/title/Wake-on-LAN) on this subject to setup your device to Wakup on LAN.
|
||||||
|
- Run a daemon on the target machine to accept shutdown requests.
|
||||||
|
|
||||||
|
## Design goals
|
||||||
|
|
||||||
|
- Do not have any dependency on other crates, only on shared libraries shipped with the distro.
|
||||||
|
- Do not start any additional process. (No Command::new stuff)
|
||||||
|
- Configuration should only have MAC addresses as they are permanent for a device. Do not configure any IP address
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Run `wolz` to view the help text.
|
Run `wolz` to view the help text.
|
||||||
|
|
||||||
|
### Shutdown functionality
|
||||||
|
|
||||||
|
Run `wolz` under daemon mode to start listening to tcp traffic on port (check code for port). Make sure firewall doesn't block.
|
||||||
|
|
||||||
|
The daemon process can be started as systemd service after network.targets. The user running should have the following permissions, setup in polkit. Create a new rule.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ # Read the config below and update the subject.user as appropriate
|
||||||
|
$ cat /etc/polkit-1/rules.d/50-poweroff-chips.rules
|
||||||
|
polkit.addRule(function(action, subject) {
|
||||||
|
if ((action.id == "org.freedesktop.login1.power-off" ||
|
||||||
|
action.id == "org.freedesktop.login1.power-off-multiple-sessions" ||
|
||||||
|
action.id == "org.freedesktop.login1.reboot" ||
|
||||||
|
action.id == "org.freedesktop.login1.reboot-multiple-sessions") &&
|
||||||
|
subject.user == "chips") {
|
||||||
|
return polkit.Result.YES;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
This tool broadcasts the magic packet to the broadcast address (and port 9) of all networks the physical interfaces connect to.
|
This tool broadcasts the magic packet to the broadcast address (and port 9) of all networks the physical interfaces connect to.
|
||||||
|
|||||||
+11
-6
@@ -47,14 +47,19 @@ fn main() -> WResult<()> {
|
|||||||
fn print_usage() -> WResult<()> {
|
fn print_usage() -> WResult<()> {
|
||||||
println!(
|
println!(
|
||||||
"{}",
|
"{}",
|
||||||
r#"usage: woly ARG
|
r#"usage: woly COMMAND ARG
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
ARG Either the mac address of the device to send the wol magic
|
COMMAND One of `up`, `down` or `daemon`
|
||||||
packet to, or a nickname specified in woly.conf to lookup
|
`up` - wakes up the device.
|
||||||
the mac. See details about config file below.
|
`down` - shuts down the device.
|
||||||
Eg: woly aa:bb:cc:dd:ee:ff
|
`daemon` - Runs a daemon. This needs to be running on
|
||||||
Eg: woly potato
|
the target machine that needs to be shutdown
|
||||||
|
ARG Either the mac address of the device or a nickname
|
||||||
|
specified in woly.conf to lookup the mac. See details
|
||||||
|
about config file below.
|
||||||
|
Eg: woly up aa:bb:cc:dd:ee:ff
|
||||||
|
Eg: woly down potato
|
||||||
|
|
||||||
Config file:
|
Config file:
|
||||||
Filename woly.conf
|
Filename woly.conf
|
||||||
|
|||||||
Reference in New Issue
Block a user