From a6e9622f70b7b072bd26c1ab86b698935f7f5d05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Wed, 29 May 2019 10:57:53 +0200 Subject: [PATCH] Migrate commandlauncher plugin documentation --- commandlauncher/README.md | 59 +++++++++++++++ .../deviceplugincommandlauncher.cpp | 75 ------------------- 2 files changed, 59 insertions(+), 75 deletions(-) create mode 100644 commandlauncher/README.md diff --git a/commandlauncher/README.md b/commandlauncher/README.md new file mode 100644 index 00000000..15001422 --- /dev/null +++ b/commandlauncher/README.md @@ -0,0 +1,59 @@ +# Application and script launcher + +This plugin allows you to execute system commands and start bash scripts. + +## Application launcher + +The application launcher allows you to call bash applications or commands with parameters from nymea. +Once, the application started, the `running` state will change to `true`, if the application +is finished, the `running` state will change to `false`. + +### Example + +An example command could be [espeak](http://linux.die.net/man/1/espeak). (`apt-get install espeak`) + + espeak -v en "Chuck Norris is using nymea" + +## Bash script launcher + +The bashscript launcher allows you to start a bash script (with parameters) +from nymea. Once, the script is running, the `running` state will change to `true`, if the application +is finished, the `running` state will change to `false`. + +### Example + +An example for a very useful script could be a backup scrip like following `backup.sh` script. + + + #!/bin/sh + # Directories to backup... + backup_files="/home /etc /root /opt /var/www /var/lib/jenkins" + + # Destination of the backup... + dest="/mnt/backup" + + # Create archive filename... + day=$(date +%Y%m%d) + hostname="nymea.io" + archive_file="$day-$hostname.tgz" + + # Print start status message... + echo "Backing up $backup_files to $dest/$archive_file" + date + echo + + # Backup the files using tar. + tar czf $dest/$archive_file $backup_files + + echo + echo "Backup finished" + date + echo "===========================" + echo " DONE, have a nice day! " + echo "===========================" + + +To make the script executable use following command: + + chmod +x backup.sh + diff --git a/commandlauncher/deviceplugincommandlauncher.cpp b/commandlauncher/deviceplugincommandlauncher.cpp index 6b0ae122..6abe927f 100644 --- a/commandlauncher/deviceplugincommandlauncher.cpp +++ b/commandlauncher/deviceplugincommandlauncher.cpp @@ -21,81 +21,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/*! - \page commandlauncher.html - \title Application and script launcher - \brief Plugin for system commands. - - \ingroup plugins - \ingroup nymea-plugins-maker - - The application and script launcher plugin allows you to execute bash commands and start bash scripts. - - \chapter Application launcher - - The application launcher \l{DeviceClass} allows you to call bash applications or commands (with parameters) - from nymea. Once, the application started, the \tt running \l{State} will change to \tt true, if the application - is finished, the \tt running \l{State} will change to \tt false. - - \section3 Example - An example command could be \l{http://linux.die.net/man/1/espeak}{espeak}. (\tt{apt-get install espeak}) - \code - espeak -v en "Chuck Norris is using nymea" - \endcode - - - \chapter Bashscript launcher - - The bashscript launcher \l{DeviceClass} allows you to call bash script (with parameters) - from nymea. Once, the script is running, the \tt running \l{State} will change to \tt true, if the script - is finished, the \tt running \l{State} will change to \tt false. - - \section3 Example - An example for a very useful script could be a backup scrip like following \tt backup.sh script. - \code - #!/bin/sh - # Directories to backup... - backup_files="/home /etc /root /opt /var/www /var/lib/jenkins" - - # Destination of the backup... - dest="/mnt/backup" - - # Create archive filename... - day=$(date +%Y%m%d) - hostname="nymea.io" - archive_file="$day-$hostname.tgz" - - # Print start status message... - echo "Backing up $backup_files to $dest/$archive_file" - date - echo - - # Backup the files using tar. - tar czf $dest/$archive_file $backup_files - - echo - echo "Backup finished" - date - echo "===========================" - echo " DONE, have a nice day! " - echo "===========================" - \endcode - - To make the script executable use following command: - - \code - chmod +x backup.sh - \endcode - - \chapter Plugin properties - Following JSON file contains the definition and the description of all available \l{DeviceClass}{DeviceClasses} - and \l{Vendor}{Vendors} of this \l{DevicePlugin}. - - For more details how to read this JSON file please check out the documentation for \l{The plugin JSON File}. - - \quotefile plugins/deviceplugins/commandlauncher/deviceplugincommandlauncher.json -*/ - #include "deviceplugincommandlauncher.h" #include "plugin/device.h"