Web server which supports removing a file immediately after it has been downloaded once? - apache

I need a web server that allows me to remove a file after it has been successfully downloaded once. Is there any way to do this with apache?
Is there another web server I can use for this task? I had already looked into Tornado for this purpose, but couldn't find a way to get an event to fire as soon as the download finished. the on_connection_close would only fire when I shut down the server.
I'd prefer something PHP or Python-based if I have to code it myself.

you might be able to accomplish this with LUA (lighttpd + mod_magnet) - but im not sure... besides that im not aware of any modules that has event triggers on "downloads" there are some that work with uploads like the mod_uploadprogress in lighttpd. im sure nginx has some similar modules... besides that... i think the only solution here is:
http://redmine.lighttpd.net/wiki/lighttpd/HowToWriteALighttpdPlugin

Related

Automatically Update PM2 Processes

I'm looking to automate how my bots are updated. They're hosted on a VPS from GalaxyGate and kept alive using PM2. I use VSCode to develop them, then I push to GitHub and pull the code from there to the VPS to update them directly in production. However, this currently has to be done manually and I always forget the git commands that I'm supposed to run.
I'm looking to have this process automated; ideally the server would periodically run some sort of script to update all bots that are hosted on it. It would fetch GitHub and apply the new changes (if any) and properly restart the bots, so I have a few questions:
Is this possible, and if so, how would I go about doing that?
Are there any risks/downsides with such a system?
Any help would be appreciated

Send commands from lighttpd to mono application

I'm working on a project and what I want to do, I have installed lighttpd on my raspberry pi which is running xbian and I have created asp file using to control xbmc by using some .net library.I got mono application as well to control xbmc and I want to send command or signal or message from lighttpd to the running mono application
How to do this, do i have to use any rpc, pipe etc.
thank you
You could either use the lua or php plugin, parse the requests there and run your stuff accordingly.
A rather difficult alternative would be to write a plugin yourself and make that do whatever it needs to do (though this will require at least decent C skills as well as security awareness) http://redmine.lighttpd.net/projects/1/wiki/HowToWriteALighttpdPlugin
https://www.mono-project.com/docs/web/fastcgi/
Separately, if files are downloading instead of being processed, then ensure that you have configured lighttpd.conf mimetype.assign

Restarting only a portion of a rack/Sinatra app

The great thing about PHP is that if you have something like
clothes.com, clothes.com/men.php, clothes.com/women.php
Then if you only edit the men's page, only that particular "app" will be restarted.
But on rack/Sinatra I have to touch the restart.txt file to restart the ENTIRE website.
Is there a way around this problem, so that users browsing other parts of the site wont have any problems while another part of the site get edited?
(i'm using mod-passenger on Apache, not that it's important..)
This would be true in all cases anyway for editing (non-inline) views (not layouts).
Aside from that, if you're really worried about this then I'd suggest using versioned folders to hold the application code. When you do a deployment, change the proxy to point at the newer version. Those who had already made requests will remain on an instance of Apache and the application that is already running, as long as their request remains alive, and seemlessly (unless you've broken something with the code) move to the new code on the next request.
It's also a convenient way to rollback to the/a previous version quickly and easily.
Check out the sinatra reloader from sinatra contrib

zend studio + xampp server file transfer

i been using aptana and dreamweaver for some long time, but now i wanted to use zend studio, because of there latest release and it says it can help on debugging while coding on javascript/php.
Now the thing is, i keep my project in different location and testing project in different location, just for safety and some wired thing dont happen, which sometimes empty the code for no reason. anyway in other two application i can easily make remote connection and transfer the file using the arrow button or by keyboard CTRL+ALT+U . it will upload and i can just refresh the browser to check it. on zend, i dont see any remote connections and i did change the server connection, but im not sure how i can easily transfer files, like i do in other IDE. can anyone help me on this for creating a remote connection and setting up the keywords, so i can continue to do what i use to do.
i found File Synchronization plugin for eclipse, that worked out pretty well too, its just it will auto upload, rather then i will press ctrl+alt+u, which i like more better then auto. oh well, something better then nothing.

How to start an application on the server from a webpage

Example:
The user login to the webpage => Click on a button
This action starts the executable "CreatePrettyPicture"
The file "prettypicture.jpg" is created on the server
When the user reloads the page the pretty picture "PrettyPicture.jpg" is shown on the page.
If I could start the application with a parameter it would be even better.
The server is a using Debian and as web server I'm using Apache. Please let me know if you need more information about the server configuration.
The possibility of several users clicking on the button at the same time is not a part of the problem.
You need to read up on CGI Scripts.
It's also possible that PHP is already available on your server, but I wouldn't recommend using it unless you're already familiar with it and know all of the security pitfalls, which from the question appears very unlikely.
You would be better of using a server side script with your apache installation to start the executable. This is probably easier with PHP (which should be easy to install if it isnt already), here are the commands. As long as you dont actually use any input with the page it should be safe enough.