Submission Spider for automatically returning results to PrimeNet
To help those who wish to further automate the use of mfaktc and mfakto, we have written a small
Perl script to assist. Please download the submit_spider here.
This can be run manually from the command line, or automatically via a crontab.
To use, download the script to your computer(s) running mfaktc or mfakto, and either place it in the
same directory, or some central location (e.g. your "bin/" directory). Then make it executable
("chmod +x submit_spider").
Next, edit the file with your favorite text editor, and change "YOUR_USERNAME" to be your PrimeNet username,
and "YOUR_PASSWORD" to be your PrimeNet password. If you use a web proxy, change that as well. No further
modifications to the script should be required.
To test the script, simply "cd" into the directory your mfakt* "results.txt" file is located, and execute the
script. It will attempt to log into PrimeNet using your above credentials, and if (and only if) successful,
it will submit the results to PrimeNet.
Note that if there are any errors (e.g. networking problems; "Database unavailable" errors, etc), the script will
rename the results.txt file to be "not_completely_submitted_YYYYMMDD_HHMMSS.txt" so you can manually attempt later.
If the script is successful, it will rename the results file to be "submitted_YYYYMMDD_HHMMSS.txt" so you can
double check that everything is working correctly. If you trust the script enough, you can set the "$DeleteAfterSend"
variable to be 1 and it will delete the file instead so your directory doesn't get too cluttered.
To use the script from a crontab, add as the parameter the directory where the results.txt file is located.
For example, if you placed the script in your "~/bin/", and you have an instance of mfakt* running in "~/mfaktc/",
creating one of these entries:
20 * * * * ~/bin/submit_spider ~/mfaktc/
...or...
20 * * * * ~/bin/submit_spider ~/mfaktc/ >/dev/null
...in your crontab will automatically execute the script at twenty minutes after every hour. Note that it is advisable to
redirect the output to /dev/null as in the second example above, or else set the "$ConsoleLogging" variable to
4 when using in a crontab. Otherwise you will be e-mailed the output from the script every time it runs.
Please note that this is version 0.1 of the script, thrown together in a couple of hours. Please
let us know if there are any issues or suggestions.
Also, while this was created under Linux, it should be possible to make it work under Windows without too much effort.
Feedback on what is needed to do so appreciated.
|