9 Replies Latest reply: Dec 6, 2010 11:06 AM by sean69 RSS

    Restarting a different applicaiton?

    sean69 Community Member

      hum. small question, I have 2 applications, one app ~administers~ the other. I can restart the admin application easily enough with onApplicationStart(); , but how can I restart the slave application???

       

      -thanks

      -sean

       

      No answers?>?>?

       

      can this even be done?

        • 1. Re: Restarting a different applicaiton?
          sean69 Community Member

          bump

          • 2. Re: Restarting a different applicaiton?
            bah1234ir Community Member

            <cfscript>
            applicationTracker = createObject("java","coldfusion.runtime.ApplicationScopeTracker");
            daapplication = applicationTracker.getApplicationScope("saidApplication");
            applicationTracker.cleanUp(daapplication);
            </cfscript>

            • 3. Re: Restarting a different applicaiton?
              sean69 Community Member

              I would up setting a flag in the database and looking for it on a new session in the slave application....

               

              <cfquery name="applicationReStart" datasource="#application.dsn#">
                          select value from Settings where name = 'ApplicationRestart';
                      </cfquery>
                     
                      <cfif applicationReStart.value is "true" >
                          <cfquery name="update" datasource="#application.dsn#">
                              update Settings set
                              value = 'false'
                              where name = 'ApplicationRestart';
                          </cfquery>
                     
                          <cfset onApplicationStart() />
                     
                      </cfif>

              • 4. Re: Restarting a different applicaiton?
                BKBK CommunityMVP
                hum. small question, I have 2 applications, one app ~administers~ the other. I can restart the admin application easily enough with onApplicationStart(); , but how can I restart the slave application???

                I assume the slave application is in a subdirectory of the admin application. I also assume the slave application's Application.cfc is within that subdirectory. All that is needed is for the admin to open any cfm page in the slave application.

                • 5. Re: Restarting a different applicaiton?
                  sean69 Community Member

                  no - actually the slave is on a different domain altogether.

                  it is possible that at some point it could be on a different server! [but not very likely]

                   

                  the check database flag thing on a new session works well, but seems like it could be better....

                   

                  -sean

                  • 6. Re: Restarting a different applicaiton?
                    BKBK CommunityMVP

                    no - actually the slave is on a different domain altogether.

                    it is possible that at some point it could be on a different server! [but not very likely]

                    No problemo. You may use cfhttp to call a page in the slave application.

                    • 7. Re: Restarting a different applicaiton?
                      sean69 Community Member

                      Hi;

                       

                      thanks - yes, I was just thinging "webservice" after my last post there.,...  my EXACT thought was:

                       

                      admin app creates a key in the database table I already set up  [something nasty like a cfid+big_long_random_string]

                      admin app posts the key, and an ident string to the remote webapp.

                       

                      remote webapp checks the ident string, if it's good, checks the key against the one the admin app stored, if that's good = onApplicationStart();

                       

                      that ought to be secure enough and keep kiddeis from hammering at the database

                       

                      might be a good idea to even implement a timeout or something as well...

                       

                       

                      anyway .. thanks.

                       

                      -sean

                      • 8. Re: Restarting a different applicaiton?
                        BKBK CommunityMVP

                        An application restart is only relevant if you want to reset application variables in the admin application as well as in the slave application.However, you've so far mentioned no application-wide variables.

                        • 9. Re: Restarting a different applicaiton?
                          sean69 Community Member

                          I would up having to do something like this:

                           

                           

                          <cfcomponent>
                               <cffile action="read"  
                          file="#getDirectoryFromPath(getCurrentTemplatePath())#application-name" 
                           variable="this.name" charset="utf-8" />
                               <cfscript>
                                   //this.name = "newride-ss23fv3-grg346";
                                   this.applicationTimeout = createTimeSpan(2,0,0,0);
                                   this.clientmanagement= "yes";
                                   this.loginstorage = "session" ;
                          

                           

                           

                           

                          in the administration there is a manual link  and form to fill out to restart the application, basically it just  regenerates the application-name file so that when application.cfc gets  it's next request the application name has changed.

                           

                          Just wondering if there are security issues or other problems that might be associated with doing things like this.

                           

                          -thanks

                          -sean