CruiseControl.net newbie question: Following a build/deploy of a website, I'd like to invoke a specific URL on the server. I don't need anything back from the resulting page, just need to request it to make something happen.
I could create an entry to to fire up IE with the URL as an argument, but I don't want to actually run IE on the server - I just want to invoke the URL.
Is there a Windows shell command to do that? Or, is there a CruiseControl.net-specific way to hit a URL?
you can use wget, a command line browser to accomplish this.
http://gnuwin32.sourceforge.net/packages/wget.htm
Related
I would like to develop a really simple addon in Thunderbird (based on Firefox addons) that executes an action when I type some commands. Ideally I'd either type something like:
$ thunderbird -myplugin someArgs
or
$ curl 127.0.0.1:12345/myplugin/someargs
But I don't want to run more complex codes as I want to be sure that the user can check imediately that it does not run any malware (I don't want the plugin to have full control on the OS).
Any idea how I could do that?
I'd like to execute a shell script form my Rails app on the client.
In my case, I want to open a .odt file on the Client PC when he clicks on a link.
As for now, all I can do is run shell script on my server using e.g.
`libreoffice path_to_my_odt_file`.
In this case, I'm opening my file using LivreOffice on the Server.
Is there a way to execute this code on my Client from Rails?
If I try to run my app as it is, when I call the action that calls my script, the file is opened on my Server.
Thank you in advance.
As mentionned in the comments, running arbitrary shell scripts on the client from the http server would be a huge security flaw.
As long as your Rails server provides a download link with send_data (e.g. dynamically_generated_odt_file), the browser will ask if it should download the file or open it. If the user wants to avoid any extra interaction, there's the possibility to tick :
"Do this automatically for files like this from now on"
You might have to specify the MIME type, by adding
Mime::Type.register "application/vnd.oasis.opendocument.text", :odt
to config/initializers/mime_types.rb.
I am trying to get rails to select document attachments, then kick off the email client with the documents attached.
I have it working on my development laptop. If I build a string with the appropriate parameters and pass that to system() then it kicks off the email client with the attachments..
The string looks something like
#email_content = "C:\Program Files (x86)\IBM\Lotus\Notes\notes.exe"
"Mailto:?Attach=C:\Users\cm\RubymineProjects\technical_library\public\images\1\8302_printed.pdf
The first part calls the notes exe and the second part starts and email with the attachments. That worked fine on my laptop.
However, when I moved it to the server, it isn't kicking off the email client. I believe that it is because the shell commands are trying to execute on the server, not on the client.
Is it possible to run a shell command on the client machine? I am trying to get this working with Windows first and then the Mac environmemnt. I tried changing the C:\ to the machine name. i.e. \chrislaptop\Program Files (x86)\IBM\Lotus\Notes\notes.exe. but that didn't work.
No, fortunately that is not possible.
Imagine what happens when a request to some random page on the internet could trigger shell scripts on your local computer...
Arbitrary code execution escaping the browser is too invasive-- your app should not have access to the client's machine.
However, some applications may support URIs that open specific applications outside the browser. You generally see this more on mobile devices, but Spotify for example supports links that look like: spotify:artist:5lsC3H1vh9YSRQckyGv0Up which asks the user whether it is ok to open the Spotify application.
https://news.spotify.com/us/2008/01/14/linking-to-spotify/
I'm interested in running a graphgist locally, for which there is a script here:
https://gist.github.com/jexp/70296ce410ff431ddbef
I was able to install the modules and run the two tasks but the last line of the script:
open http://localhost:8000/?http%3A%2F%2Flocalhost%3A8000%2Fgists%2Fmy-graph-use-case.adoc
produces an error: Not Found and trying to open the link in the comments:
http://localhost:8000/gists/my-graph-use-case.adoc
causes my browser to download a file for which I have no associated application. has anyone made this work and if so, how?
according to #MichaelHunger the issue is that the default behaviour in Python's SimpleHTTPServer is such that a trailing slash (/) gets added to the end of the url, messing up the request.
according to #PratikMandrekar, in the following article, the problem is that the url as it is in the script does not explicitly specify the file name, forcing the server to redirect to the default. see:
Why does SimpleHTTPServer redirect to ?querystring/ when I request ?querystring?
so after a little experimentation I found this to work:
http://localhost:8000/index.html?http%3A%2F%2Flocalhost%3A8000%2Fgists%2Fmy-graph-use-case.adoc
notice that the colons, slashes, etc. in the inner url must be encoded for this to work
There is a bug/default behavior in simple-http-client that makes it add slashes after query parameters which breaks our app in this case, I have to find a better replacement or fix it.
Perhaps I can also change the rabbithole project to server the graphgist files itself, so that it would be self-contained.
Some users of an app of mine are reporting links dont open in the browser. I always launch them with shellexecute(0, 'open', 'http://...
what could I check for an incorrect(?) setting in the http link associations?
You're assuming that the browser registered the open verb. It may not have done so.
Just pass nil as the second parameter and omit the open, and let the OS determine what the default action is for the http:// protocol, and you should be fine.
Sounds like the default browser is not functioning quite right. I guess the first thing I would try is to have them enter an (any) url into start->run and see if that pops up.
You could also have them register what the settings on the URL below are:
http://russenreaktor.wordpress.com/2010/07/01/solved-fix-default-protocol-http-association-in-windows/
Or use the ftype utility on the cmdline:
C:\Users\marco>ftype http
http="C:\Program Files (x86)\Internet Explorer\iexplore.exe" -nohome
These operate on registry keys under HKEY_CLASSES_ROOT/protocolname with protocolname=http/ftp etc.
Making a simple app to dump these keys might help finding out what the pattern here is.
FYI, this failure can be dynamic -- i.e., the old MS PhotoEditor would block opening URLS using ShellExecute. (C.f., http://code.activestate.com/recipes/334665/ ). Fix is as noted in the recipe: write out an .HTML file and shellexecute that.