]> git.rmz.io Git - dotfiles.git/blob - zsh/functions/wake
add graph.py
[dotfiles.git] / zsh / functions / wake
1 # This plugin provides a wrapper around the "wakeonlan" tool available from most
2 # distributions' package repositories, or from the following website:
3 #
4 # http://gsd.di.uminho.pt/jpo/software/wakeonlan/
5 #
6 # In order to use this wrapper, create the ~/.wakeonlan directory, and place in
7 # that directory one file for each device you would like to be able to wake. Give
8 # the file a name that describes the device, such as its hostname. Each file
9 # should contain a line with the mac address of the target device and the network
10 # broadcast address.
11 #
12 # For instance, there might be a file ~/.wakeonlan/leto with the following
13 # contents:
14 #
15 # 00:11:22:33:44:55:66 192.168.0.255
16 #
17 # To wake that device, use the following command:
18 #
19 # # wake leto
20 #
21 # The available device names will be autocompleted, so:
22 #
23 # # wake <tab>
24 #
25 # ...will suggest "leto", along with any other configuration files that were
26 # placed in the ~/.wakeonlan directory.
27 #
28 # For more information regarding the configuration file format, check the
29 # wakeonlan man page.
30
31 function wake() {
32 local config_file="$HOME/.wakeonlan/$1"
33 if [[ ! -f "$config_file" ]]; then
34 echo "ERROR: There is no configuration file at \"$config_file\"."
35 return 1
36 fi
37
38 if (( ! $+commands[wakeonlan] )); then
39 echo "ERROR: Can't find \"wakeonlan\". Are you sure it's installed?"
40 return 1
41 fi
42
43 wakeonlan -f "$config_file"
44 }