Silly idea of the day — I want a script that listens on a secret email address and executes commands I send it via email, and then emails me back the results. Email is the universal API.
Silly idea of the day — I want a script that listens on a secret email address and executes commands I send it via email, and then emails me back the results. Email is the universal API.
Well said! 🙂
Actually wouldn’t be too hard to setup, one of the wp-mail mods (ketai I think) does something similar by piping the email to a script to publish the moblog so it is a push instead of a pull from wp-mail via a cron or wp-cron job. I was always meaning to implement something like that myself for my own moblogging but now Flickr is taking care of all that for me.
It would just be a matter of modifying the script to run other commands based upon the content of the email, although of course you would want to be real careful about protecting against malicious emails just in case someone found out the secret email.
Hmm, I thought about doing it over IM… Would seem more useful.
I actually have a business idea dependent on the ability to trigger scripts over email. I came up with a week ago so I haven’t investigated yet. Anyone?
http://codewar.net/cuts/
This is actually designed for cell phones, but will work just as well with plain e-mail addresses I believe. Try it out, works great from my cell, nice for giving the server a kick on the go.
Pipe an email address into a php script and shell_exec it? Of course … you’d be running the script as ‘nobody’ unless you use phpsuexec I believe which would make permissions a bit weird and whatnot, but … it’d probably work (and you’d be able to do all kinds of custom stuff since you’re already good at PHP).
Stranger things exist ! 😉
Actually not silly at all, I’ve been using something like this for about two years, very handy when behind a slow and filtering corporate firewall (mostly to wget stuff and get them sent me back)
You can do this with the smrsh shell from sendmail on linux/unix.
Create a new user on your system. ex: secret_email (change this to your secret email address)
edit /etc/aliases and add a line:
secret_email: “|/etc/smrsh/script_name”
then run “newaliases”
Then create a script called script_name, or whatever in /etc/smrsh
Once the server recieves an email to this account, it can do whatever the script dictates.
I have a working script in Python, just email me for it, unless is it okay to post in the comments.
The script searches the incoming mail for a line like , and parses out the command and spawns a child process to run it. The stdout is then captured, and returned to an email address you specify.
I remember to have used procmail for such kind of tasks about ten years ago.
http://www.procmail.org/
Wrong. The command line is the universal API.
Fix that typo please, it’s hurting my eyes.
If you are thinking of mucking about with your server/s from a Treo, do not use E-mail. Wrong tool for a simple task.
http://www.sealiesoftware.com/pssh/
Hope it helps…
I’m mostly on a Blackberry these days.
For that you might have to pay:
http://www.idokorro.com/imssh.html
That’s the chance you take when steering away from Open Source. Palm may not be Open Source-oriented, but its users’ ideaology differs.
$95?!
I think Matt is right actually. No doubt the CLI is great if you’re on a *nix system, but with so many different platforms out there today, Email is about the ONLY thing that works exactly the same across all of them.
The book multitool linux has a whole section looking at how to do this. It’s also a great book for ideas re: linux solutions. Probably not aimed at someone with as much experience but I found it useful and interesting
Use a web page to send commands and get results.
The web is the universal API 🙂 Ajax could to a part in this.
I thought MFC was the universal API.
I remember from the old BBS days, when I dindn’t have Internet access, to use FTP via e-mail (actually, FidoNet netmail, at the time).
One would issue commands (like directory listings) and get the command results in another message. When you’d like to download a file, the file would be sent to you as an attachment or something like that.
It was my first kind of Internet access…
MFC? *LOL*. Probably XML-RPC.
Ah yes, the days of DOS, FIDONet, Mustang Wildcat…those were the days. Everything was command line! You were in control and was a lot less work as you didn’t have to search for everything. Question: Has anyone had any luck with a command line interface for Novell GroupWise? Seems they have the SMTP server so restricted here that you can’t even alert you phone for your next meeting!!! Thanks