Killing a web app

I have a web app. I would like to kill it before uploading a new version (this seems to be recommended).

I have another web app, which I use to do things like update some tables and do other maintenance tasks.

What I would like to be able to do is invoke the killall command from the maintenance app. Is this possible? (I thought I’d ask before going nuts trying to figure it out.)

-Bob (in Minneapolis, where it’s starting to cool off)

Christ - wish I’d read the body of your post before the headline. I took that as an order …

Why not do it through a command line access, just for the app you want to stop ?

Otherwise, see the excellent advice provided by Phillip Zedalis from 1701 Software at http://1701software.com/blog/upgrading_xojo_cgi_apps.php

[quote=139388:@Bob Gordon]I have a web app. I would like to kill it before uploading a new version (this seems to be recommended).

I have another web app, which I use to do things like update some tables and do other maintenance tasks.

What I would like to be able to do is invoke the killall command from the maintenance app. Is this possible? (I thought I’d ask before going nuts trying to figure it out.)

-Bob (in Minneapolis, where it’s starting to cool off)[/quote]
You’re going to have issues… killall requires root access.

[quote=139398:@Michel Bujardet]<…>
Otherwise, see the excellent advice provided by Phillip Zedalis from 1701 Software at http://1701software.com/blog/upgrading_xojo_cgi_apps.php[/quote]
Phil’s approach is to add a timer to the webapp which keeps checking if the cgi file is still around. If one deletes the files, then the app quits all by itself and one can upload the new version.

Works fine for me.

[quote=139443:@Oliver Osswald]Phil’s approach is to add a timer to the webapp which keeps checking if the cgi file is still around. If one deletes the files, then the app quits all by itself and one can upload the new version.

Works fine for me.[/quote]

That is the best solution IMHO, especially when command line access to the server is not available.

Even if through shell, one can benefit from a crude terminal.

Even with SSH access if you kill the app any active users will auto-restart the process as they are browsing the CGI. You need a way to kill the app and keep it shut down long enough to upload the new binary. The approach I took was the easiest way to handle it. Open to other ideas if anyone has any or Xojo has any best practices.

Philip’s solution isn’t a bad one. I’d go one step further and configure the web server for that directory so that if the .cgi file is missing, it redirects the user to an html file that says something like “Down for Maintenance” so users don’t get a 404 error while it’s not there, just in case it’s an extended time (like if you found a critical bug that’ll take some time to fix).

@Greg O’Lone

How do you do this?

Yes, the Phillip approach works perfectly.

Depends on the web server used. A simpler alternative is to just replace the .cgi with one of your own that outputs the page you want:

#!/usr/bin/perl print "Content-type: text/plain\ \ "; print "<html>"; print "<head><title>Be back soon!</title></head>"; print "<body><h1>Down for maintenance.</h1></body>"; print "</html>"

Then when you upload the new version of your app it overwrites the .cgi putting your server back in action.

But the app would still see the cgi and not quit?

[quote=227811:@Richard Albrecht]@Greg O’Lone
How do you do this?[/quote]

One way is to use htaccess :

That would not stop the app process on the server, as the cgi is only a launcher to a binary program. So effectively it would prevent a new user to restart a session, but if for some reason the app has become unresponsive, uploading a new one won’t do anything.

Phillip’s solution is simple to implement and does not require any special maintenance : delete the files, the app quits, upload, and the next user will restart the cgi.