|
| 1 | +# Restify |
| 2 | +Make any program/script a rest service! |
| 3 | + |
| 4 | +This project is under development. Please feel free to fork and contribute! 😀 |
| 5 | + |
| 6 | + |
| 7 | +### How to use Restify |
| 8 | + |
| 9 | +When you first run the application following folder structure should be created. (The application will then exit) |
| 10 | + |
| 11 | +* /usr/local/var/Restify/Logs |
| 12 | +* /usr/local/var/Restify/Configuration |
| 13 | + |
| 14 | +##### Create a configuration file in /usr/local/var/Restify/Configuration. |
| 15 | +**Name - Restify_Rest_Jobs.xml** |
| 16 | + |
| 17 | +**Content of the XML -** |
| 18 | + |
| 19 | + <?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
| 20 | + <ns2:restConfiguration xmlns:ns2="com.gaurav.restify.configuration"> |
| 21 | + <restJobs> |
| 22 | + <restJob> |
| 23 | + <args>val1<args> |
| 24 | + <args>val2<args> |
| 25 | + <command>Testscript.sh</command> |
| 26 | + <commandType>BASH</commandType> |
| 27 | + <path>/Users/gaurav/Downloads</path> |
| 28 | + <waitTime>20</waitTime> |
| 29 | + </restJob> |
| 30 | + <restJob> |
| 31 | + <command>TestPython.py</command> |
| 32 | + <commandType>PYTHON</commandType> |
| 33 | + <path>/Users/gaurav/Downloads</path> |
| 34 | + <waitTime>20</waitTime> |
| 35 | + </restJob> |
| 36 | + </restJobs> |
| 37 | + </ns2:restConfiguration> |
| 38 | + |
| 39 | + |
| 40 | +##### Executing the script |
| 41 | + |
| 42 | +* curl http://localhost:8080/execute/script-name |
| 43 | +* example - curl http://localhost:8080/execute/Testscript.sh |
| 44 | +[You can also hit the URL in a browser] |
| 45 | +* output - |
| 46 | + **{"processExecCode":"0","output":"Hello!\n"}** |
| 47 | + |
| 48 | + |
| 49 | +##### Refreshing configuration after adding a new rest job |
| 50 | + |
| 51 | +* To refresh configuration without restarting the app, |
| 52 | +* hit - curl http://localhost:8080/refresh |
| 53 | +* Output - **{"processExecCode":"0","output":"Configuration Refreshed"}** |
| 54 | + |
| 55 | + |
0 commit comments