Author Topic: Execute an external program - Solved.  (Read 2307 times)

I'd like to execute an external program, passing arguments from within blockland. The purpose of this is to make a /report command that sends me a text message. I've already made the external program and it sends me the SMS. All I need to do is link it up to the Blockland server. Of course, I will take the precautions to prevent starfishs from draining my credit. Is there any way to execute a program passing arguments or at least just execute it? (The arguments could be passed via a text file that Blockland writes and the external program reads).
« Last Edit: September 21, 2015, 09:12:53 PM by Pie Crust »

(The arguments could be passed via a text file that Blockland writes and the external program reads).
So just have Blockland write in a text file when someone uses the /report command?
Code: [Select]
%file = new fileObject();
%file.openForWrite("config/server/report.txt");

%file.writeLine("Some dude just used /report!");

%file.close();
%file.delete();
openForWrite clears the file of all text and then writes in it.
openForAppend just starts writing at the bottom of the file.

And execute the program to avoid having to keep it running 24/7 side-by-side with the server.

You have to have something running 24/7 to detect when that file is modified, you have no way around that.

You have to have something running 24/7 to detect when that file is modified, you have no way around that.
forget. Oh well, I'm leaving this open just in case someone figures something out.

Instead of using a file you can create a server and just listen for a TCP request from Blockland.

Instead of using a file you can create a server and just listen for a TCP request from Blockland.
Or if you have access to a web server you can just put a PHP (or whatever else you want) script that accepts a GET or POST request that connects to an SMS gateway
Or if your number and carrier is known ahead of time (if its only for you) you can send SMS via email via email and not bother with figuring out an SMS gateway

EDIT: Actually on second thought, I believe I've heard that BL doesn't work with HTTPS? So It might not be smart to do that
« Last Edit: September 21, 2015, 05:45:13 PM by Headcrab Zombie »

Or if your number and carrier is known ahead of time (if its only for you) you can send SMS via email via email and not bother with figuring out an SMS gateway
This was the plan, lol. But according to my carrier's policy, I am charged for receiving the messages and it would be annoying, anyways.

How would I send the data to the php script?

Instead of using a file you can create a server and just listen for a TCP request from Blockland.
Or I can make an external program that checks a folder with reports every 15 minutes or so instead of making a second server...

How would I send the data to the php script?
a GET or POST request
TCPObjects

Or I can make an external program that checks a folder with reports every 15 minutes or so instead of making a second server...
You'd still have to have something always on

I'm curious as to why you don't want something running 24/7 for this?

You'd still have to have something always on
I'd rather have it on my php server which I have running because proxy and school web restrictions (:3) than running another server.



TCPObjects
I meant how would the php script need to be to receive the data and send it via smtp?


I'm curious as to why you don't want something running 24/7 for this?
Waste of the little resources I have.

I'd rather have it on my php server which I have running because proxy and school web restrictions (:3) than running another server.
What? How is that relevant, unless you're trying to host blockland on school internet?
And if you are, I think the game itself is the problem, not this

I meant how would the php script need to be to receive the data
GET or POST
There's really nothing more I can tell you except for linking an article about what web requests are, which is like the first step to learning php...

and send it via smtp?
There's a mail function which is the first result in a google search

Waste of the little resources I have.
A BL server uses like 1000x the resources this tiny little thing would use...
« Last Edit: September 21, 2015, 06:00:32 PM by Headcrab Zombie »

What? How is that relevant, unless you're trying to host blockland on school internet?
No, I meant I already have a php server running and it would be better to run the script off of there than run another server just to listen to Blockland.

There's really nothing more I can tell you except for linking an article about what web requests are, which is like the first step to learning php...
Ok.

There's a mail function which is the first result in a google search
Except that mail has no authentication which is something I would need.

A BL server uses like 1000x the resources this tiny little thing would use...
Blockland isn't the only thing I host off of the same machine, you know.

Except that mail has no authentication which is something I would need.
No function has it's own authentication, you do that yourself at the beginning of the request.
Pass a password to the script in the request and verify that.
Except I believe it's not a good idea because
I believe I've heard that BL doesn't work with HTTPS? So It might not be smart to do that

Blockland isn't the only thing I host off of the same machine, you know.
Which only makes my point even more relevant?
A tiny application listening to TCP requests and sending SMSs is insignificant compared to everything you're hosting.
If adding that tiny of a thing kills your resources, then your resources are already dead

EDIT: Actually on second thought, I believe I've heard that BL doesn't work with HTTPS? So It might not be smart to do that
Blockland can only send plain text with tcpobjects