Executing remote python script
-
wrote on 24 May 2013, 18:33 last edited by
I have a python script on my server that I need to execute at certain times (basically whenever I upload a file, we execute this script on said file). How would I go about doing this? The file upload fine, but I have no idea where to start when it comes to executing the python script. Any help would be appreciated, thanks!
-
wrote on 24 May 2013, 20:13 last edited by
Some years ago I needed do something like you.
I can't remember the code, but I used os.stat() every x seconds to check modifications on directories. When stat was modified, ran a special funtion to process changed files (always new files in my case).
Hope it help. -
wrote on 25 May 2013, 07:08 last edited by
How does this relate to Qt? What OS are you uploading to?
-
wrote on 27 May 2013, 12:16 last edited by
Sorry about that, I should have given a bit more detail.
I'm using Qt to build my client on the front end. I want to execute the Python script on a Ubuntu server from the client after I upload a file (done using QNetworkRequest to POST the data).
-
wrote on 27 May 2013, 19:16 last edited by
I would not even try to trigger the script from the client side. Can't you make your server trigger the script in response to the upload?
If that is not possible then services like upstart (at least the newer versions) can actually monitor directories and trigger scripts whenever they change. Or you can use inotifywait to do the same without upstart.
-
wrote on 28 May 2013, 12:07 last edited by
Thanks for the reply Tobias. I'll figure out something server side as oppose to triggering it from the client.
5/6