Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

AutoExNT.bat terminates when user logs out.

Posted on 2007-07-25
17
Medium Priority
?
1,002 Views
Last Modified: 2009-07-29
I am using the autoExNT service to run a batch file without needing a user to be logged in.  My problem is that when ever a user logs in... and then logs back out the batch file quits.   I had it working the way i wanted, with the batch running regardless if someone was logged in or not and it wouldn't be affected by user log outs before i joined the computer to our domain.   This happens regardless of the user logged in whether its a local user account or a domain account.  

Please let me know if you need anymore information.  And many thanks in advance!
0
Comment
Question by:reflexit
  • 7
  • 6
  • 2
  • +1
16 Comments
 
LVL 8

Expert Comment

by:Anthony2000
ID: 19571482
So, you have it set to run when the machine boots? But, later when someone logs in and then logs out, the batch file quits? Is this correct?
0
 

Author Comment

by:reflexit
ID: 19574268
yes that is correct.
0
 
LVL 8

Expert Comment

by:Anthony2000
ID: 19574739
I should have asked this also. What is your batch file doing and does it ever end? Does it run continuously. My guess is that it runs continuously. But what is it doing. Can you post it? Is it long?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:reflexit
ID: 19574979
here is the batch file:

echo Email To Case Agent v1.06
cd \"program files"\email-to-case\EmailAgent
java -jar -Xmx256M Email2Case.jar sfdcConfig.txt log4j.properties >> "c:\Program Files\email-to-case\EmailAgent\e2c.log"

what this is doing is running our email to case agent for salesforce... while running it checks our email accounts for new mail and when it detects one it will grab its info input it into salesforce create a case and send a reply back to the client with the case number along with some other information.  

if you run this with a user account the command prompts stays up displaying its check every minute... so my goal was to have this run as a service so no one would have to be logged in, and have it dump its information into the e2c.log file.

everything works great, even when someone logs in, its when that user gets logged out that the batch file quits, and i can verify by the output in the log file stating that it has shut down.

Hope this is the info you were looking for.
0
 

Author Comment

by:reflexit
ID: 19577381
Just an update, i tried removing it from the domain to see if i could get it back to way it was before with no luck.  So I'm not sure if it was a fluke that it was working from the beginning or not.  Either way i would love to have this running on my domain with the autoexnt service unaffected by users.  A thought just occurred to me that i will rule out shortly is the accounts i have used to log in have all been administrator accounts... maybe non-administrator accounts would work?   But again i would ideally like for the service to be unaffected by that.  If anyone has another idea to get this working i am all ears as well.

Thanks again!
0
 
LVL 8

Expert Comment

by:Anthony2000
ID: 19580134
Is the "local system" account the account that the AutoExNT.bat is running under? Or do you have it set to run under an admin account? I don't see any reason why it would behave the way it does. Are you sure it is running? Can you test it? Have you tested it?
0
 

Author Comment

by:reflexit
ID: 19582242
Yes i have tested it and it works.  Yes it is using the Local System account.  I can attach screen shots if you'd like... if i able to do so here.  Here is a brief snippet of the log.

2007-07-27 09:32:49,643 [main] INFO  Starting EmailToCase Agent v1.06
2007-07-27 09:32:49,643 [main] INFO  ============================================================================
2007-07-27 09:32:49,643 [main] INFO               J A V A    S Y S T E M   P R O P E R T I E S
2007-07-27 09:32:49,643 [main] INFO  ============================================================================
2007-07-27 09:32:49,643 [main] INFO  java.runtime.name= Java(TM) SE Runtime Environment
2007-07-27 09:32:49,643 [main] INFO  sun.boot.library.path= C:\Program Files\Java\jre1.6.0_01\bin
2007-07-27 09:32:49,643 [main] INFO  java.vm.version= 1.6.0_01-b06
2007-07-27 09:32:49,643 [main] INFO  java.vm.vendor= Sun Microsystems Inc.
2007-07-27 09:32:49,643 [main] INFO  java.vendor.url= http://java.sun.com/
2007-07-27 09:32:49,643 [main] INFO  path.separator= ;
2007-07-27 09:32:49,643 [main] INFO  java.vm.name= Java HotSpot(TM) Client VM
2007-07-27 09:32:49,643 [main] INFO  file.encoding.pkg= sun.io
2007-07-27 09:32:49,643 [main] INFO  sun.java.launcher= SUN_STANDARD
2007-07-27 09:32:49,643 [main] INFO  user.country= US
2007-07-27 09:32:49,643 [main] INFO  sun.os.patch.level= Service Pack 2
2007-07-27 09:32:49,643 [main] INFO  java.vm.specification.name= Java Virtual Machine Specification
2007-07-27 09:32:49,643 [main] INFO  user.dir= C:\Program Files\email-to-case\EmailAgent
2007-07-27 09:32:49,643 [main] INFO  java.runtime.version= 1.6.0_01-b06
2007-07-27 09:32:49,643 [main] INFO  java.awt.graphicsenv= sun.awt.Win32GraphicsEnvironment
2007-07-27 09:32:49,643 [main] INFO  java.endorsed.dirs= C:\Program Files\Java\jre1.6.0_01\lib\endorsed
2007-07-27 09:32:49,643 [main] INFO  os.arch= x86
2007-07-27 09:32:49,643 [main] INFO  java.io.tmpdir= C:\WINDOWS\TEMP\
2007-07-27 09:32:49,643 [main] INFO  line.separator=

2007-07-27 09:32:49,643 [main] INFO  java.vm.specification.vendor= Sun Microsystems Inc.
2007-07-27 09:32:49,643 [main] INFO  user.variant=
2007-07-27 09:32:49,643 [main] INFO  os.name= Windows XP
2007-07-27 09:32:49,643 [main] INFO  sun.jnu.encoding= Cp1252
2007-07-27 09:32:49,643 [main] INFO  java.library.path= C:\WINDOWS\system32;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Windows Resource Kits\Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
2007-07-27 09:32:49,643 [main] INFO  java.specification.name= Java Platform API Specification
2007-07-27 09:32:49,643 [main] INFO  java.class.version= 50.0
2007-07-27 09:32:49,643 [main] INFO  sun.management.compiler= HotSpot Client Compiler
2007-07-27 09:32:49,643 [main] INFO  os.version= 5.1
2007-07-27 09:32:49,643 [main] INFO  user.home= C:\
2007-07-27 09:32:49,643 [main] INFO  user.timezone= America/New_York
2007-07-27 09:32:49,643 [main] INFO  java.awt.printerjob= sun.awt.windows.WPrinterJob
2007-07-27 09:32:49,643 [main] INFO  file.encoding= Cp1252
2007-07-27 09:32:49,643 [main] INFO  java.specification.version= 1.6
2007-07-27 09:32:49,643 [main] INFO  java.class.path= Email2Case.jar
2007-07-27 09:32:49,659 [main] INFO  user.name= SYSTEM
2007-07-27 09:32:49,659 [main] INFO  java.vm.specification.version= 1.0
2007-07-27 09:32:49,659 [main] INFO  java.home= C:\Program Files\Java\jre1.6.0_01
2007-07-27 09:32:49,659 [main] INFO  sun.arch.data.model= 32
2007-07-27 09:32:49,659 [main] INFO  user.language= en
2007-07-27 09:32:49,659 [main] INFO  java.specification.vendor= Sun Microsystems Inc.
2007-07-27 09:32:49,659 [main] INFO  awt.toolkit= sun.awt.windows.WToolkit
2007-07-27 09:32:49,659 [main] INFO  java.vm.info= mixed mode, sharing
2007-07-27 09:32:49,659 [main] INFO  java.version= 1.6.0_01
2007-07-27 09:32:49,659 [main] INFO  java.ext.dirs= C:\Program Files\Java\jre1.6.0_01\lib\ext;C:\WINDOWS\Sun\Java\lib\ext
2007-07-27 09:32:49,659 [main] INFO  sun.boot.class.path= C:\Program Files\Java\jre1.6.0_01\lib\resources.jar;C:\Program Files\Java\jre1.6.0_01\lib\rt.jar;C:\Program Files\Java\jre1.6.0_01\lib\sunrsasign.jar;C:\Program Files\Java\jre1.6.0_01\lib\jsse.jar;C:\Program Files\Java\jre1.6.0_01\lib\jce.jar;C:\Program Files\Java\jre1.6.0_01\lib\charsets.jar;C:\Program Files\Java\jre1.6.0_01\classes
2007-07-27 09:32:49,659 [main] INFO  java.vendor= Sun Microsystems Inc.
2007-07-27 09:32:49,659 [main] INFO  file.separator= \
2007-07-27 09:32:49,659 [main] INFO  java.vendor.url.bug= http://java.sun.com/cgi-bin/bugreport.cgi
2007-07-27 09:32:49,659 [main] INFO  sun.io.unicode.encoding= UnicodeLittle
2007-07-27 09:32:49,659 [main] INFO  sun.cpu.endian= little
2007-07-27 09:32:49,659 [main] INFO  sun.desktop= windows
2007-07-27 09:32:49,659 [main] INFO  sun.cpu.isalist=
2007-07-27 09:32:49,659 [main] INFO  ============================================================================
2007-07-27 09:32:49,659 [main] INFO  Parsing config file: sfdcConfig.txt
2007-07-27 09:32:49,705 [main] INFO  Config successfully parsed
2007-07-27 09:32:49,705 [main] INFO  ============================================================================
2007-07-27 09:32:49,705 [main] INFO              C O N F I G U R A T I O N   P R O P E R T I E S
2007-07-27 09:32:49,705 [main] INFO  ============================================================================
2007-07-27 09:32:49,705 [main] INFO  file: sfdcConfig.txt
2007-07-27 09:32:49,705 [main] INFO  services:com.sforce.mail.EmailService:C:\\Program Files\\email-to-case\\EmailAgent\\email2case.txt
2007-07-27 09:32:49,705 [main] INFO  notify:port:25
2007-07-27 09:32:49,705 [main] INFO  notify:host:smtp.mycompany.com
2007-07-27 09:32:49,705 [main] INFO  notify:notifyEmail:email@mycompany.com
2007-07-27 09:32:49,705 [main] INFO  notify:service:com.sforce.mail.SMTPNotification
2007-07-27 09:32:49,705 [main] INFO  notify:from:email@mycompany.com
2007-07-27 09:32:49,705 [main] INFO  notify:password:********
2007-07-27 09:32:49,705 [main] INFO  notify:user:user
2007-07-27 09:32:49,705 [main] INFO  attachments:largeAttachmentDirectory:\mail\
2007-07-27 09:32:49,705 [main] INFO  attachments:largeAttachmentURLPrefix:file:\mail\
2007-07-27 09:32:49,705 [main] INFO  attachments:largeAttachmentSize:0.5
2007-07-27 09:32:49,705 [main] INFO  sfdcLogin:userName:username
2007-07-27 09:32:49,705 [main] INFO  sfdcLogin:password:********
2007-07-27 09:32:49,705 [main] INFO  sfdcLogin:timeout:600
2007-07-27 09:32:49,705 [main] INFO  sfdcLogin:url:https://www.salesforce.com/services/Soap/u/7.0
2007-07-27 09:32:49,705 [main] INFO  sfdcLogin:loginRefresh:30
2007-07-27 09:32:49,705 [main] INFO  ============================================================================
2007-07-27 09:32:49,705 [main] INFO  Loading configuration file sfdcConfig.txt
2007-07-27 09:32:49,721 [main] INFO  Parsing config file: C:\\Program Files\\email-to-case\\EmailAgent\\email2case.txt
2007-07-27 09:32:49,736 [main] INFO  Config successfully parsed
2007-07-27 09:32:49,736 [main] INFO  ============================================================================
2007-07-27 09:32:49,736 [main] INFO              C O N F I G U R A T I O N   P R O P E R T I E S
2007-07-27 09:32:49,736 [main] INFO  ============================================================================
2007-07-27 09:32:49,736 [main] INFO  file: C:\\Program Files\\email-to-case\\EmailAgent\\email2case.txt
2007-07-27 09:32:49,736 [main] INFO  server1:protocol:imap
2007-07-27 09:32:49,736 [main] INFO  server1:interval:1
2007-07-27 09:32:49,736 [main] INFO  server1:readbox:processedmails
2007-07-27 09:32:49,736 [main] INFO  server1:inbox:Inbox
2007-07-27 09:32:49,736 [main] INFO  server1:errorbox:unabletoprocess
2007-07-27 09:32:49,736 [main] INFO  server1:userName:username
2007-07-27 09:32:49,736 [main] INFO  server1:password:********
2007-07-27 09:32:49,736 [main] INFO  server1:url:my.companymail.com
2007-07-27 09:32:49,736 [main] INFO  server2:protocol:imap
2007-07-27 09:32:49,736 [main] INFO  server2:interval:1
2007-07-27 09:32:49,736 [main] INFO  server2:readbox:processedmails
2007-07-27 09:32:49,736 [main] INFO  server2:inbox:Inbox
2007-07-27 09:32:49,736 [main] INFO  server2:errorbox:unabletoprocess
2007-07-27 09:32:49,736 [main] INFO  server2:userName:username
2007-07-27 09:32:49,736 [main] INFO  server2:password:********
2007-07-27 09:32:49,736 [main] INFO  server2:url:my.companymail.com
2007-07-27 09:32:49,736 [main] INFO  ============================================================================
2007-07-27 09:32:49,736 [main] INFO  Attempting to start service com.sforce.mail.EmailService with configuration file C:\\Program Files\\email-to-case\\EmailAgent\\email2case.txt
2007-07-27 09:32:51,155 [main] INFO  LoginURL: https://www.salesforce.com/services/Soap/u/7.0
2007-07-27 09:32:51,155 [main] INFO  Agent will connect to: https://na1-api.salesforce.com/services/Soap/u/7.0
2007-07-27 09:32:51,155 [main] INFO  Scheduling poll process against my.companymail.com
2007-07-27 09:32:51,155 [main] INFO     Port    : default
2007-07-27 09:32:51,155 [main] INFO     UserID  :
2007-07-27 09:32:51,155 [main] INFO     Password:
2007-07-27 09:32:51,155 [main] INFO     Interval: 1 minute(s)
2007-07-27 09:32:51,155 [main] INFO     InBox   : Inbox
2007-07-27 09:32:51,155 [main] INFO     ReadBox : processedmails
2007-07-27 09:32:51,155 [main] INFO     ErrorBox: unabletoprocess
2007-07-27 09:32:51,155 [main] INFO  Service my.companymail.com:0:anothermailbox:Inbox successfully registered
2007-07-27 09:32:51,357 [main] INFO  Scheduling poll process against my.companymail.com
2007-07-27 09:32:51,357 [main] INFO     Port    : default
2007-07-27 09:32:51,357 [main] INFO     UserID  : mailbox
2007-07-27 09:32:51,357 [main] INFO     Password:
2007-07-27 09:32:51,357 [main] INFO     Interval: 1 minute(s)
2007-07-27 09:32:51,357 [main] INFO     InBox   : Inbox
2007-07-27 09:32:51,357 [main] INFO     ReadBox : processedmails
2007-07-27 09:32:51,357 [main] INFO     ErrorBox: unabletoprocess
2007-07-27 09:32:51,357 [main] INFO  Service my.companymail.com:0:mailbox:Inbox successfully registered
2007-07-27 09:32:51,357 [main] INFO  com.sforce.mail.EmailService  loaded as a timer service.
2007-07-27 09:32:52,542 [Timer-0] INFO     processing 0 messages
2007-07-27 09:32:53,851 [Timer-0] INFO     processing 0 messages
2007-07-27 09:33:52,330 [Timer-0] INFO     processing 0 messages
2007-07-27 09:33:53,748 [Timer-0] INFO     processing 0 messages
2007-07-27 09:34:52,336 [Timer-0] INFO     processing 0 messages
2007-07-27 09:34:53,645 [Timer-0] INFO     processing 0 messages
2007-07-27 09:35:55,911 [Timer-0] INFO     processing 0 messages
2007-07-27 09:35:58,062 [Timer-0] INFO     processing 0 messages
2007-07-27 09:36:52,255 [Timer-0] INFO     processing 0 messages
2007-07-27 09:36:53,673 [Timer-0] INFO     processing 0 messages
Salesforce.com Email to Case Agent Shutting down.

so its working fine i can send emails and the batch does its trick, when i log in as any user on that machine for whatever reason and log off, i can watch as im logging off with my wintail program on another machine it gives me the "Salesforce.com Email to Case Agent Shutting down."  I dont understand this either... if this is a service and its running with a system account before any user logs in... it should not be affected by someone who logs in and out.  

0
 
LVL 8

Expert Comment

by:Anthony2000
ID: 19583614
When a user logins in, is there any special scripts that are run that might be causing this behavior?
0
 

Author Comment

by:reflexit
ID: 19584965
not that i know of.  I only have another batch script launching the wintail program to tail the e2c.log file.

I did a little more testing on this and this is what i found out.  First i downloaded a remote task manager, and learned how to use the sc \\computer query autoexnt command.  When the computer first boots, when i query the service i can see it "running" and in the task manager i can see the autoexnt.exe file running in addition to java.exe (which is what the batch script does).  After a few minutes the service is "stopped" and the autoexnt.exe is no longer in the task manager, BUT java.exe is, which leads me to believe that the autoexnt.bat file is still running... that and information is still being dumped into the e2c.log.  Once i log in with any user i can view that indeed the service has stopped and that the autoexnt.exe file is not in the process list in task manager, and that java.exe is still running as it should.  When i log off with that user i can see that the java.exe is no longer running and in my e2c.log that it says that the salesforce email 2 case is shutting down.

So is this normal behavior?   Shouldn't the service be running all the time?  At the point the service stops is it no longer in control of the batch file??? I am stumpped
0
 
LVL 8

Expert Comment

by:Anthony2000
ID: 19586585
Do you have the source to the java app? I'm guessing, no.  Another idea, but may take some work and knowledge of java: create a skeleton java app that performs some of the same functions (but only for testing). Run it in place of the normal app. But armed with the source you can capture more information about your environment and write it to a log file. For example the java app is being told to exit, hence the message "is shutting down". Something is sending some sort of message or event to the java app and it is inturn using this information to shut itself down. Unfortunately this is all I can think of for the moment. I will see if I can come up with something else. Or maybe another expert may know more than I do.
0
 
LVL 8

Expert Comment

by:Anthony2000
ID: 19605212
Have you figured it out? If not, can you do the following: Boot the machine so that it runs the program. Log in as admin (run spy++ and have it capture all messages sent the java application). Next login again as admin, and then log out. Does this logout cause the program to shutdown? And if it did, maybe the spy++ program may show what messages were sent to the application.
0
 

Author Comment

by:reflexit
ID: 19622187
Ok, Ill give that a shot tomorrow.  I believe that the batch is being closed and thus ending the java session... thats my guess.  But ill find that app and give it a shot.  Thanks for you help thus far! I really appreciate it.
0
 
LVL 8

Expert Comment

by:Anthony2000
ID: 19625583
This may be silly, but have you tried the psexec command from http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/PsExec.mspx
It has a command line option  "-d" that will run the process without waiting for it. What I would like you to try is run the java application in its own process space without it being connected with the batch file. This way if the batch file were to "close" it should have no effect with the java app. Just a thought.
0
 

Expert Comment

by:caseyjones72
ID: 22328023
Has this issue been resolved by using the psexec command?  I don't want to tread down a path if it isn't working.  I have the same issue of a batch file running as a service via Autoexnt.bat.  When the system starts up the service starts and runs fine.  The second any user logs onto the system and then logs off the service terminates.  Found this discussion chain, but I didn't see a final resolution.  
0
 
LVL 1

Accepted Solution

by:
bala_pbiddle earned 2000 total points
ID: 22418925
VOILA!  I have been having the same problem, and I think I've finally come upon a solution.  I discovered this after doing some testing trying to launch both java and native windows processes from autoexnt.bat.  The Windows process I tested (sleep.exe) *did not* get terminated after logging on and off a console session.  So I dug a little deeper and found the magical -Xrs JVM option.  This option apparently keeps Java from responding to certain signals from the OS.  It fixed my problem, java.exe stays in memory forever!
So, try setting the -Xrs JVM option for your java process, I think it will work.
You can read more about this option at http://java.sun.com/j2se/1.3/docs/tooldocs/win32/java.html
0
 

Expert Comment

by:caseyjones72
ID: 22461915
I was able to resolve my issue using -Xrs when calling the launchclient - bala pbiddle you took care of me.  Thanks for the response.  It was huge!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question