Closed jgabello closed 10 years ago
I think these changes make a lot of sense, particularly the improved command line options handling and the logging changes. The addition of tig
as a dependency does mean that there's one extra dependency that's needed for a default raspbian installation, but I think this is fine as not all of the dependencies are there by default anyway.
It's nice to see someone wanting to contribute and improve this script!
I've corrected the error typo and added verbose and proper logging functionality.
cURL Support
I've added additional support and checking for cURL when wget is not present on a system. Default installations of OSX no longer have wget installed. The script tests for the presence of wget and cURL before attempting to run any API commands. If neither utility is present, an error is thrown and the script will terminate.
Logging
I've changed default error output to use the logger command present on *nix and OSX systems. This allows an individual to simply watch the system log to spot failures of the script running as a cronjob.
Configuration File Creation
The script now creates a default configuration file if no file is found. It will also create the necessary $HOME/.config/ directory if it is not present. The configuration file includes additional documentation specifying what options should be set. An addition parameter of LOGGING has also been included and will be used to enable and disable use of logger.
Command Line Options
I've added command line options, parsed with getopts, for control of the script from the shell. In addition to -k (KEY) and -r (RECORD), options have been added to specify an IP address (-i), enable or disable logging (-L true/false), save options to configuration file (-S), and perform a Save Option Only run of the script (-d).