From f6127d38bc3a776a7fae9f121113a9141b19384d Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Thu, 21 Oct 2010 14:30:00 +0100 Subject: [PATCH] Add a CLI version to bebox.reboot. --- misc/bebox-reboot.rst | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/misc/bebox-reboot.rst b/misc/bebox-reboot.rst index df71482..f97ae81 100644 --- a/misc/bebox-reboot.rst +++ b/misc/bebox-reboot.rst @@ -3,13 +3,28 @@ How to reboot your bebox using the CLI :date: 2010-10-21 -I've an internet connection which , for some obscure reasons, tend to be very +I've an internet connection which, for some obscure reasons, tend to be very slow from time to time. After rebooting the box (yes, that's a hard solution), all the things seems to go fine again. -Well, that's not the optimal sulution, that's a bit "gruik", but it works. +EDIT : Using grep +================= -If you have similar problems with yours, you can try this script: +After a bit of reflexion, that's also really easy to do using directly the +command line tools curl, grep and tail (but really harder to read). + +.. code-block:: bash + + curl -X POST -u joel:joel + http://bebox.config/cgi/b/info/restart/\?be\=0\&l0\=1\&l1\=0\&tid\=RESTART -d + "0=17&2=`curl -u joel:joel + http://bebox.config/cgi/b/info/restart/\?be\=0\&l0\=1\&l1\=0\&tid\=RESTART | + grep -o "name='2' value='[0-9]\+" | grep -o "[0-9]\+" | tail -n 1`&1" + +The Python version +================== + +Well, that's not the optimal solution, that's a bit "gruik", but it works. .. code-block:: python