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