Issue Replacing CGI app on Apache

I am running my Xojo compiled app on a Linux VPS - it runs fine, no problems at all.
The site is not live yet, so the only people using it is us 3 internally testing it.

Whenever we release a new version of the CGI app, I upload a ZIP of the files, unzip, delete all existing files and copy over to /scgi-bin.
However, accessing the app, results in a page not found error, for an indeterminable length of time., I have noticed one time it took an hour, another time 18 hours. I am guessing that something should be killed before replacing the files.

I am running the TOP application under command line, and the actual executable is released from memory within a few minutes of closing the browser page.

I seem to recall a month ago seeing somewhere a specific action that needs to be taken when uploading a replacement CGI app files. but now of course I cant remember anything about it.

This is a solution I came up with awhile ago that a few people are using: http://www.dev.1701software.com/blog/2013/09/08/upgrading-xojo-cgi-apps

[quote=157911:@Mark Blake]I am running my Xojo compiled app on a Linux VPS - it runs fine, no problems at all.
The site is not live yet, so the only people using it is us 3 internally testing it.

Whenever we release a new version of the CGI app, I upload a ZIP of the files, unzip, delete all existing files and copy over to /scgi-bin.
However, accessing the app, results in a page not found error, for an indeterminable length of time., I have noticed one time it took an hour, another time 18 hours. I am guessing that something should be killed before replacing the files.

I am running the TOP application under command line, and the actual executable is released from memory within a few minutes of closing the browser page.

I seem to recall a month ago seeing somewhere a specific action that needs to be taken when uploading a replacement CGI app files. but now of course I cant remember anything about it.[/quote]

Look at Phillip Zedalis solution. It is simple to implement and I warmly recommend it.

For now, if you have access to your VPS line of command (SSH, Telnet), here is what you can do to stop the current process, so the new cgi will take effect immediately :

  • Type PS Aux [Return]
  • In the list of processes, look for your app cgi process and note the process number (second columns)
  • type Kill [Process number] [Return]

Usually, there is only one line with your app name. However, if a session is running, it will have it’s own line. If you think it maybe a user running the app, you may want to wait until it is over, or kill it too.

I do think there’s also a killall app_name thingy. Don’t know if its recommended but it should kill all instances of your app.

You are right Albin. I never used it but it seems convenient if there are many occurences :

For a cgi web app I have running, I have a url built into handleSpecialURL that executes app.quit. When I need to update the app, I load this url in my browser first, then replace the app.

Thanks Philip, from memory thats the article I have previously seen but could not find again at the time.
I’ll get my programmer to implement that into the app, its much less work for me :slight_smile:

This will work so long as nobody else is using the app. If someone else’s session hits that CGI it will attempt to launch it while you are attempting to overwrite it. IF it launches before you replace it then the old one will still be running. This can cause issues with the new one launching. Just FYI.