Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Is there a command line to Unload apps (Read 23866 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Is there a command line to Unload apps
Feb 22nd, 2009 at 10:33pm
Print Post Print Post  
Command line SUnlock unlocks the application. Is there any command line for Unloading an application.  In multiusers Server/Client environment, external application  cannot be unlocked if it is loaded. So, first one has to unload it before it can be unlocked. Yes, all these can be done through server administration.  However, if both can have commandlines, both (Unload and unlock) can be accomplished for locked external database (application) at the same time using @Shell()  from within the application with a press of a button.

Any Ideas?  Thanks.
  
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Is there a command line to Unload apps
Reply #1 - Feb 23rd, 2009 at 2:39am
Print Post Print Post  
Does this help?

Sysinternals is a suite of utilities that was acquired  by Microsoft a few years ago.  The suite of tools is now called PsTools, current version is 2.44.  One of the utility files is psfile which will allow you to ID files that are opened by a remote connection and enable you to close the file by filename.

See here: http://technet.microsoft.com/en-us/sysinternals/bb897552.aspx for info on the file.
See here to download the suite: http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx

From the command line help:

PsFile lists or closes files opened remotely.

Usage: psfile [\\RemoteComputer [-u Username [-p Password]]] [[Id | path] [-c]]
    -u        Specifies optional user name for login to
              remote computer.
    -p        Specifies password for user name.
    Id        Id of file to print information for or close.
    Path      Full or partial path of files to match.
    -c        Closes file identified by file Id.
Omitting a file identifier has PsFile list all files opened remotely.
------------------------------------------------------------------------
-----------
So, syntax to close the file would be something like this:
psfile C:\Sesame2\Sesame.exe -c

You can use this to see if anyone is currently connected to the file before closing it.  This also has the advantage of allowing you to close a file even if it is open by another user, useful for nightly backups when people forget to exit their programs properly.


  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Is there a command line to Unload apps
Reply #2 - Feb 23rd, 2009 at 5:27am
Print Post Print Post  
Hi Bob,

Thanks for response.  I believe this will cause Sesame to close down. What we want is just to Unload an application that is to be Unlocked. While working on the application, you notice that some of the values retrieval by x-commands from external database (application) failed in normally daily operational application.  You are reasonably sure that the external database is locked.

I am not sure if SUnlock first unloads the application and then Unlocks it, but if that happens it would be ideal.  If the application is loaded, that one can see in server administration, and if you tried Unlocking the locked application, it will fail to unlock. In this case you will unload the application and then Unlock it, both of these processes are carried out using Server Administration.

The same way one will have to Unload the application before reconciling it. I believe, this issues are more relevant to Server/Client multi-User environment.

I am looking for a way to Unlock even loaded application using commandline, so that User (of course - authorized to do so) can do it by pressing a button on the Menu. I believe, this will be good for support.

Does SUnlock command unloads the application before unlocking?


  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Is there a command line to Unload apps
Reply #3 - Feb 23rd, 2009 at 6:06am
Print Post Print Post  
Looking into it further, it seems SUnlock does not unload the application. There is another commandline utility provided is Lock_status.exe.  The file gets locked because it is in use (loaded) or locked because of some other problem such as power failure, improper closing or malfunction.  Lock_Status utility will indicate Locked (Locked: 1) only if it is truly locked. If it loaded, it will show that file is not locked (Lock: 0).  This is my understanding so far.

I would like to have a little deeper understanding, so that I would not end up causing any damage to the application inadvertently.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Is there a command line to Unload apps
Reply #4 - Feb 23rd, 2009 at 1:56pm
Print Post Print Post  
Sunlock does not unload an application. It merely unlocks one. If you unlock a loaded application, anyone using that application will get a message indicating that this has happened and will have their access to the application disabled. The lock_status program, only indicates if an application is locked. It does not indicate if an application is loaded. If an application is locked, always check very thoroughly that that application is not loaded before considering using any of the tools to unlock it. The locking mechanism is the server's way of understanding that a file is loaded. It can check if that server has the file loaded, but can't check if a different server has it loaded by any means other than the locking flag.

From the command line, you can shutdown, suspend, and continue server activity. If you want to back up an active application, you can use any of the several means built into Sesame: backup on load, backup on save, and backup on interval. Or, you can suspend the server and copy the files (both of them) out from under the server, and then continue again. If it is absolutely necessary to unload the application, there is a SBasic command UnloadApplication, that will unload an application that is not actually in use by a user. It would be fairly simple to build a tiny application that allows this on a push button, or unloads a specific application when the tiny application is loaded (and thereby resembles a command line tool).
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Is there a command line to Unload apps
Reply #5 - Feb 23rd, 2009 at 2:47pm
Print Post Print Post  
Quote:
If it is absolutely necessary to unload the application, there is a SBasic command UnloadApplication, that will unload an application that is not actually in use by a user. It would be fairly simple to build a tiny application that allows this on a push button, or unloads a specific application when the tiny application is loaded (and thereby resembles a command line tool).


Hi Mark, can you please give info on SBasic UnLoadApplication command for command line? If it is available, I would like to have it. Thanks.  Bharat
  
Back to top
 
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Is there a command line to Unload apps
Reply #6 - Feb 23rd, 2009 at 3:03pm
Print Post Print Post  
Yes, the sample I provided would shut down Sesame.  When I read application, I was thinking of any Windows program, including Sesame.  But now I understand that you were talking specifically about shutting down a Sesame application file, vs. a generic Windows application.

So, the syntax to do that might be:
psfile C:\Sesame2\Data\Fielname.db -c
psfile C:\Sesame2\Data\Fielname.dat -c

No time to test now, will try in the next few days.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Is there a command line to Unload apps
Reply #7 - Feb 23rd, 2009 at 4:36pm
Print Post Print Post  
Bharat_Naik wrote on Feb 23rd, 2009 at 2:47pm:
Quote:
If it is absolutely necessary to unload the application, there is a SBasic command UnloadApplication, that will unload an application that is not actually in use by a user. It would be fairly simple to build a tiny application that allows this on a push button, or unloads a specific application when the tiny application is loaded (and thereby resembles a command line tool).


Hi Mark, can you please give info on SBasic UnLoadApplication command for command line? If it is available, I would like to have it. Thanks.  Bharat


It is an SBasic command, not a command line tool. You would need to write a tiny application makes use of it, then closes itself - to use it as a command line tool.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Is there a command line to Unload apps
Reply #8 - Feb 23rd, 2009 at 5:09pm
Print Post Print Post  
Bob_Hansen wrote on Feb 23rd, 2009 at 3:03pm:
Yes, the sample I provided would shut down Sesame.  When I read application, I was thinking of any Windows program, including Sesame.  But now I understand that you were talking specifically about shutting down a Sesame application file, vs. a generic Windows application.

So, the syntax to do that might be:
psfile C:\Sesame2\Data\Fielname.db -c
psfile C:\Sesame2\Data\Fielname.dat -c

No time to test now, will try in the next few days.


It is never a good idea to close a file using system tools when Sesame may have that file open and writing to it. The files may end up half written or with chunks missing.
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Is there a command line to Unload apps
Reply #9 - Feb 23rd, 2009 at 5:31pm
Print Post Print Post  
Got it. Thanks.
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Is there a command line to Unload apps
Reply #10 - Feb 24th, 2009 at 4:36am
Print Post Print Post  
Bharat_Naik wrote on Feb 22nd, 2009 at 10:33pm:
...both (Unload and unlock) can be accomplished for locked external database (application) at the same time using @Shell()  from within the application with a press of a button.

Bharat,

It would seem that Mark has given you the perfect solution: UnloadApplication(filename).

You would use UnloadApplication to unload the app, then use @Shell (or CreateAProcess) to run Sunlock. The code for this could be placed in a command button, just as you originally asked for.

UnloadApplication appears to have been created for exactly what you are attempting to do. Here's the description of it from the programming guide (page 426):
UnloadApplication unloads an application from the server that was loaded by one of the X-Commands and has not been opened by an interactive client (a user). It accepts the filename of the application as its only parameter.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Is there a command line to Unload apps
Reply #11 - Feb 24th, 2009 at 5:25am
Print Post Print Post  
Carl,
I got it. I am working on it. I think, it is a lot less cumbersome for a new user.
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Is there a command line to Unload apps
Reply #12 - Feb 24th, 2009 at 2:10pm
Print Post Print Post  
You should not need to unlock the files after an unload as Sesame will unlock them when it unloads them.
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Is there a command line to Unload apps
Reply #13 - Feb 24th, 2009 at 3:18pm
Print Post Print Post  
Ray, I am little confused.  If an application is locked and you close the server, all applications will unload.  If you restart the server, all applications must be unlocked then.  I believe, that is not the case. One still needs to Unlock the subject application before it starts working.... what I mean before the main application get the value from those locked external applications using x-commands.

I understands Application loaded application gets locked but that locked status seems to be different than the locked status because of some problem with application such as power outage, or closing not done in ordinary recommended manner.

I need to understand this a little bette before I venture into uncharted  territories!!!
  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Is there a command line to Unload apps
Reply #14 - Feb 24th, 2009 at 4:08pm
Print Post Print Post  
If you close the Sesame server properly, it unlocks the loaded apps as part of the process of closing. If you kill it with something like Task Manager or use Emergency Shutdown or there is a power failure and your computer goes down, the Sesame server does not get the chance to clear the application lock.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print