mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Information & Answers (https://www.mersenneforum.org/forumdisplay.php?f=38)
-   -   bash and HTTP? (https://www.mersenneforum.org/showthread.php?t=16333)

Dubslow 2011-12-13 02:47

bash and HTTP?
 
Hey guys,
I know Christenson's working on automating mfaktc, but I was wondering, is it possible to incorporate sending HTTP stuff via bash? I'd like to crap together something just for me to report results.


Random other question to get maximum thread efficiency: Is there a way to pause just on worker in MPrime? All I can do is stop them all or start them all, without changing the prime.txt/local.txt settings every time I play Minecraft. I cannot use PauseWhileRunning because for whatever reason it always leaves a bunch of zombie processes that I can't seem to kill for the life of me, but that as far as I can tell take no system resources except lines in the process list. (That is to say, clicking end process or issuing killall Minecraft does nothing to affect the zombie processes, but MPrime still reads them.)

Christenson 2011-12-13 04:52

Dubslow:
There are certainly 9 ways to skin the mfaktc automation cat...and a bash (or perl, or Ruby, or...oh, pick your language!) script can certainly be used.

I seem to remember zombie processes as still having slots in the process table, but not doing execution or having remaining memory allocation. I don't think it would be hard under mprime to let you stop just one worker....you can certainly do it in the Windows GUI...

Dubslow 2011-12-13 06:42

Well yes, but MPrime doesn't have a GUI...

How would you do HTTP? This is about me learning something about it and being lazy than me automating mfaktc properly. That's beyond my ability and you already claimed it.

Xyzzy 2011-12-13 16:18

[QUOTE]Random other question to get maximum thread efficiency: Is there a way to pause just on worker in MPrime?[/QUOTE]In the past we have run four instances of Mprime to be able to control each one individually. It is a bit of a hassle but it works.

Xyzzy 2011-12-13 16:20

[QUOTE]How would you do HTTP?[/QUOTE]Start with learning to communicate with the server via Telnet.

chalsall 2011-12-13 18:54

[QUOTE=Dubslow;282008]I know Christenson's working on automating mfaktc, but I was wondering, is it possible to incorporate sending HTTP stuff via bash? I'd like to crap together something just for me to report results.[/QUOTE]

I don't know how to do this with just Bash, but I do know how to with Perl. Please see the [URL="http://www.mersenneforum.org/showthread.php?t=16334"]Automatic Submission Spider for Workers[/URL] thread.

It should give you a good idea about just how easy it is to build spiders using Perl. Also, hopefully, it will be useful.

Christenson 2011-12-13 23:48

I think he would need wget or something to do it with just bash...

Dubslow 2011-12-14 17:58

So I could construct my own HTTP requests with wget? That's what a quick google leads me to believe...

chalsall 2011-12-14 18:26

[QUOTE=Dubslow;282212]So I could construct my own HTTP requests with wget? That's what a quick google leads me to believe...[/QUOTE]

Sure. That's what wget does. But just to be pedantic, this isn't Bash doing the work -- it's wget being called from Bash (or whatever).

At your console (or a web browser), "man wget".

But I would still argue Perl with the LWP::UserAgent and HTTP::Cookies (optionally et al) modules is a better solution space.

Dubslow 2011-12-14 18:37

I'm sure it is, but again, this isn't about being practical. I just want a tool to mess with HTTP, and interacting with PrimeNet seems like a great way to get started (I promise I won't spam/overload it)
Also with bash I can do if [ $(wc -l results.txt) -ge 10 ]; then wget ....
and I'm sure Perl would be great too, but...

chalsall 2011-12-14 19:20

[QUOTE=Dubslow;282220]I'm sure it is, but again, this isn't about being practical. I just want a tool to mess with HTTP, and interacting with PrimeNet seems like a great way to get started (I promise I won't spam/overload it)
Also with bash I can do if [ $(wc -l results.txt) -ge 10 ]; then wget ....
and I'm sure Perl would be great too, but...[/QUOTE]

In Perl it's only a little more complicated:

[CODE]@LC = split(" ", `wc -l results.txt`);
if ($LC[0] > 10) {
...
}
[/CODE]

But I must warn you again, half of the work of spidering is dealing with unexpected results and errors.

Nearly the entire other half has to do with dealing with parcing the responses. How do you plan on handling the regular expressions? Sed? Or Awk?


All times are UTC. The time now is 05:53.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.