# lcmlog Client side of a tool for reading and writing the lcm staff logs (both admins and 150). Requests are sent via ssh using user's account. ## TL;DR: Installation and basic usage To install this software, simply clone this repository to your preferred machine; the machine doesn't have to be in the same subnet as the log server, the only requirement being that the server is reachable via SSH (through jumps, if needed). Usage: `lcmlog [-g] [-p]`. Currently supported methods are GET (`-g`) to print stored logs and POST (`-p`) to add new logs to the server. When running the software for the first time, regardless of the selected method, you will be prompted to open and edit a new configuration file with the editor corresponding to your `EDITOR` environment variable (default: `nano`). Write it as an SSH-config file (`~/.ssh/config`); this is used by the software to contact your log server. For any further questions, either run `lcmlog -h` or read the rest of this README. ## Methods #### GET The `GET` method is called with the `-g` option and is used to print all the logs that meet the required criteria. #### POST The `POST` method is called with the `-p` option and is used to add a log to the database. Accented characters are allowed and automatically transformed using quotation marks or backticks. #### UPDATE The `UPDATE` method is called with the `-u` option and is used to regenerate the internal server database. It should only be called if a log file is added by hand, or if some of the log files get renamed or corrupted. It assumes that all the log files are correctly formatted. **CURRENTLY NOT WORKING**. ## Configuration file To choose the server to communicate with, ssh uses a config file located in `~/.config/lcmlog`. The configuration file is named `config` and is a ssh config file: so, for more help, refer to ssh\_config manuals (i.e. run `man ssh_config` on your terminal). The script always checks if the config file exist: if false, it asks you if you want to generate it. Here the config file template generated by the program (`~/.config/lcmlog/config`): ``` # lcmlog config file # Write this file as a ssh_config file. # For more info, run the command 'man ssh_config'. # Host is 'server': do not change the name. Host server HostName # User and Port parameters should be used only out of the lcm cluster. #User #Port ``` After the generation, you should edit the file and add the correct `HostName` (and eventually also `User` and `Port`). This script automatically open the config file after its generation using `nano` editor. You can't use this program until the config file is generated in the default folder (`~/.config/lcmlog`). ## Editor The default editor is `nano`. If you want to use another editor, your best shot is `export`ing the `EDITOR` variable from your shell (e.g. `export EDITOR=vim`). In a future update, this customization will be included in the configuration file. ## TODO - [ ] Implement custom editor in the configuration file. - [ ] Implement the `UPDATE` method