Launch background process from unix command line and detect if it is runnin

in Cocoa, I am able to run unix app by using NSTask, it works fine to me. But I want to do the following:
1. Start up a background process.
2. Wait to see if this background process has been launched correctly.
3. If yes, keep running following codes...
With NSTask, I cannot make sure when the background process has been launched correctly... and other codes just keep running...
If I do something like:
while (bgprocess isRunning)
}

What exactly do you mean by "launched correctly"? Do you just care that the process has begun? Do you want to make sure it is still running? Do you want to see if there is some signal emitted (either affirmative "I am running" or absence of a child-died signal)?
Your isRunning example does appear to be in accord with the NSTask docs for "do blah blah blah while the task is running", but that doesn't seem to be what your description says you want to do. Is "blah blah blah" an idle loop until the task has started, or is it something to do while the task is actually running?
How about looking up the pid of the child process (processIdentifier for the NSTask) and then check whether that process is still running?

Similar Messages

  • Launching Rescue & Recovery from a Command Line

    Question - I would like to know how I can launch Rescue & Recovery from a command line.
    Issue that is prompting the question -  My laptop was sitting in my computer bag overnight. The battery was fully charged. I BELIEVE that it was in suspend mode at the time. When I opened it in the morning, there was a message on the screen saying that a backup had not completed successfully. I then noticed that the battery had run down completely.
    My Plan - I would like to launch Rescue & Recovery (as well as the Defrag utility) from Windows Task Scheduler. If I do, then all schedule tasks will be launched and controlled using the same process. Windows Task Scheduler also provides two key scheduling criteria that the IBM Rescue & Recoverry or the IBM Maintenance Manager utilities do not provide -
    #1 - Run this task only when the PC is on AC power.
    #2 - Run this task ony when the computer is idle (so that it doesn't slow down the PC if I happen to be working on it)
     Background Concerns -
    - Having a backup job automatically start when the computer is in my computer bag will run down my battery when I least expect it.
    - The PC may could also be damaged due to overheating, since the sides of the computer bag  block the ventilation holes.
    Additional Info
    - If I go to the ThinkVantage Productivity Center and select the Quick Link for "Backup Now" this will indeed launch a backup on demand. I assume that selecting this option is calling a specific executable file.
    - However, the only two applicable executable files that I see in the C:\Program Files\Lenovo\Rescue and Recovery directory are "mr_gui.exe" and "wizrr.exe". Both of these files launch an interface that requires the user to make a selection. As a result, it doesn't look as if either of these files would work for unattended operation, unless there is some sort of switch that I can put in that will automatically start the backup process.
    - I called the support line (only once so far), but that particular rep did not know of any way to launch Rescue & Recovery other than from the standard R&R user interfaces.
     Any help is greatly appreciated,
    Mathew

    The correct way to invoke a JSP is to make a request to the Server.
    Normally you would use your browser to do this.
    On a unix system, you can use the wget command to invoke a url without using a browser.

  • Is it possible to fire an ibot from unix command line?

    Hi,
    Is it possible to fire an ibot from unix command line?
    I am looking to setup a setp in a job in grid control which runs a report in order to create a cached file on the obiee server once a prior step has completed. Is this possible?

    Hi,
    Did you check this?
    is it possible to execute ibot..
    Rgds,
    Dpka

  • How to run Discoverer 10g report from unix command line

    Hello Experts,
    I am aware that discoverer report can run through command line using "dis51usr.exe /connect username/passward@connection_string /opendb "DISCOVERER.<<report name>> /export xls"".
    Can we run discoverer 10g report (stored in database) from server location / unix command line? Is there any command?
    Please assist. Thank you.

    Hi Tamir,
    Can you please mention from where we have to execute/run these commands? After setting enviornmental variable, are these commands run from any location or we have to go to particular server location and then execute (ex. from directory BI or else).
    Thank you.

  • Problem starting a scenario from Unix command line

    Hello all, many apologies if this is the wrong section of the forum, if it is and you could direct me to the right section I'd be grateful.
    If you're still reading and I am in the right section, I have a problem when using the startscen.sh script to start a scenario.
    This is what appears to be the relevant part of the log, I've had to change some values in the output for our security people.
    lots of java
    FirstUser:SUNOPSIS_INSTALL
    IndChange:I
    IntJavaName:com.sunopsis.dwg.dbobj.SnpRemRep
    IObjects:4600
    LastDate:2010-07-20 11:08:31.0
    LastUser:SUNOPSIS_INSTALL
    ObjName:OBJ_SNPREMREP_4600
    SecuPos:110]
    java.lang.NullPointerException
    08/18/2010 01:53:04 PM(main): SnpsConnection : disconnect : DbUrl : jdbc:oracle:thin:<our host and port data> : User : <our user> : ConnectID : INTERNAL_MASTER0
    08/18/2010 01:53:04 PM(main): SnpsConnection : disconnect : After ConnectionLst :
    DwgJv.main: Exit. Return code:-1
    OracleDI: Starting scenario PKG_PROCESS_FILES 001 in context Global ...
    08/18/2010 01:53:05 PM(main): DwgCmd: getUniqueThreadIdentifier : :Before : mThreadIDIncrementCounter : 0
    08/18/2010 01:53:05 PM(main): DwgCmd: getUniqueThreadIdentifier : :After : mThreadIDIncrementCounter : 1 : Unique ID : 0
    08/18/2010 01:53:06 PM(main): DwgTaskSql.supportTransactions : test transactions capability for :
    Oracle JDBC driver
    10.1.0.5.0
    08/18/2010 01:53:06 PM(main): DwgTaskSql.supportTransactions : test transactions capability for :
    Oracle JDBC driver
    10.1.0.5.0
    08/18/2010 01:53:06 PM(main): SnpsQuery.updateExecStatement : prepare request :
    Select BATCH_UPDATE_SIZE, CONNECT_TYPE, CON_NAME, DSERV_NAME, FETCH_ARRAY_SERV, FIRST_DATE, FIRST_USER, IND_JNDI, I_CONNECT, I_HOST, I_TECHNO, I_TXT_JAVA_URL, I_TXT_JNDI_URL, I_TXT_WS_BASE_URL, JAVA_DRIVER, JNDI_AUTHENT, JNDI_FACTORY, JNDI_PROTO, JNDI_PWD, JNDI_RESSOURCE, JNDI_USER, LAST_DATE, LAST_USER, PASS, USER_NAME, WS_DEPLOY_MODE from SNP_CONNECT where SNP_CONNECT.I_CONNECT=?
    08/18/2010 01:53:06 PM(main): SnpsQuery.updateExecStatement : prepare request :
    Select FIRST_DATE, FIRST_USER, I_CONNECT, LAST_DATE, LAST_USER, REP_ID, REP_NAME, REP_TIMESTAMP, REP_TYPE from SNP_REM_REP where REP_NAME = ?
    08/18/2010 01:53:06 PM(main): SnpRemRep.getObjectLst : :
    08/18/2010 01:53:06 PM(main): SnpsQuery.updateExecStatement : prepare request :
    Select AGENT_NAME, AGENT_NAME2, EXT_VERSION, FIRST_DATE, FIRST_USER, HOST_NAME, HOST_PORT, IND_CHANGE, I_AGENT, LAST_DATE, LAST_USER, MAX_THREAD from SNP_AGENT where AGENT_NAME=?
    08/18/2010 01:53:06 PM(main): SnpAgent.getObjectLst : :
    [AgentName:@
    AgentName2:null
    ExtVersion:null
    FirstDate:2010-06-22 17:47:34.0
    FirstUser:SUPERVISOR
    HostName:<out host>
    HostPort:<our port>
    IndChange:U
    IAgent:1000
    LastDate:2010-06-23 12:40:32.0
    LastUser:SUPERVISOR
    MaxThread:1000]
    08/18/2010 01:53:06 PM(main): SnpsQuery.updateExecStatement : prepare request :
    Select AUT_SUPERVISOR, EXPIRACY_DATE, EXT_VERSION, FIRST_DATE, FIRST_USER, IND_CHANGE, I_TXT_DETAIL, I_WUSER, LAST_DATE, LAST_USER, PASS, USER_EXPIRACY_DATE, WUSER_INIT, WUSER_NAME from SNP_USER where WUSER_NAME=?
    08/18/2010 01:53:06 PM(main): SnpUser.getObjectLst : :
    [AutSupervisor:1
    ExpiracyDate:null
    ExtVersion:null
    FirstDate:2010-06-21 08:22:32.0
    FirstUser:SUNOPSIS_INSTALL
    IndChange:I
    ITxtDetail:null
    IWuser:1999
    LastDate:2010-06-21 08:24:44.0
    LastUser:SUNOPSIS_INSTALL
    Pass:hZyX6tylA1y5R.RcRlQdfp
    UserExpiracyDate:null
    WuserInit:SU
    WuserName:SUPERVISOR]
    08/18/2010 01:53:06 PM(main): SnpsQuery.updateExecStatement : prepare request :
    Select EXT_VERSION, FIRST_DATE, FIRST_USER, IND_CHANGE, INT_JAVA_NAME, I_OBJECTS, LAST_DATE, LAST_USER, OBJ_NAME, SECU_POS from SNP_OBJECT
    08/18/2010 01:53:06 PM(main): SnpObject.getObjectLst : :
    [ExtVersion:null
    FirstDate:2010-06-21 08:21:48.0
    FirstUser:SUNOPSIS_INSTALL
    IndChange:I
    lots of java
    If anyone could shed some light I would be very grateful.
    izz

    Fantastic! Thankyou for your help. I realise my problem was that I copied jdic.jar into the project folder to save effort, but forgot tray.dll. I had seen tray.dll in that error output, but simply hadn't made the connection - you know how it is after staring at the same problem for a whole evening!
    As it is, I only had to copy tray,dll into the project folder and it works fine. :D.
    Thanks a lot.

  • Export Apex application from the command line and eliminate Apex

    I had a problem to migrate version 4.0.2 to 4.1 Apex, and I can not access to Apex. I open a Thread with the problem but so far I have no answers.
    Given that Apex is not working, I can think to do the following:
    ---Export applications that are currently installed in Apex
    ---Totally eliminate the apex and do a new install
    Does anyone know if this is a viable option?
    If Yes, what package I have to run to make the export of applications?
    How do I completely remove the current installation of Apex? And leave prepared the database for a new installation from scratch, the version of Oracle we use is 11 g Enterprise Edition Release 11.2.0.1.0.
    If someone can give me any advice would be very grateful.
    Best regards
    Gerard

    Hi Patrick
    +(-) Do Have you had any installation issues?+
    I had some but I think that are already resolved, I have another open thread Re: Big problem in update to Apex 4.1 with the details of the problems I had.
    +(-) Do Have you checked the log files?+
    Where can I find them?
    +(-) What is your database version?" "Does Is it XE?"+
    I'm using "Oracle11g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production"
    +(-) Which web server do you use to access APEX (Apache with mod_plsql, APEX Listener or Embedded PL/SQL gateway (EPG))?+
    Embedded PL/SQL gateway
    +(-) Which URL did you use in the past to access APEX?+
    This URL: http://192.168.0.5:8080/apex/apex
    +(-) What happens if you enter http://192.168.0.5:8080/apex+
    If enter "http://192.168.0.5:8080/apex/" I get the following error
    "Error ERR-1014 Application not found."
    "application = 4500 workspace = 10"
    Thanks a lot
    Gerard

  • Is it possible to run Acrobat3D from the command line?

    I'd like to know if it is possible to run Arobat3D from the command line in batch mode. I'm interested in knowing if this is possible in either a windows or unix environment.
    My objective is to convert CAD data e.g. CATIA V5 or DXF etc to PDF, in batch mode without using the Acrobat3D interface itself.
    I know that it's possible to run a batch process from within Acrobat3D itself, therefore one solution may be to invoke those batch processes from the command line.
    I've looked through the other listings on this forum and seen this question asked previously, but I've not seen any responses that suggest this is even a feasible concept.

    As of now, it's not possible in the cmd-mode to just remain connected and not stream.
    But the reason you want to do that is because of the long start-up time. That 20 sec time can be divided into:
    1. launch time
    2. time to start encoding (after pressing start button) -> cannot be reduced even if 'connected only' feature is available in cmd-line
    Below are tips you can use to reduce this 20 sec of time:
    1. Lesser the no. of devices connected to the system, shorter is the launch time. Disable the devices which are not to be used in the session.
    2. Try using device indexes (0, 1, 2, etc) instead of device names in the profile. Indexes might change after you disable some of the devices.
    3. Use the profile with correct settings, to avoid any validation errors.
    4. Higher the video size, higher is the overall time. Small sizes take lesser time to start.
    Let me know if you see any improvement in the startup time.

  • Starting the nzrView in listen mode from the command line...

    I want to be able to start the nzrViewer in listen mode when I log into windows and then be able to accept an invite for a collaboration session. When I added a shortcut to the "nzrViewer.exe /listen 5550" to my Startup Folder, it launches the Remote Listener just fine, but when I someone invites me to collaborate a Remote Session, I get an error message "Ticket not provided for Rights Authentication."
    I believe that the problem is when I launch the Viewer from the command line, I'm not authenticated to the Zen server, so it can't verify my Rights.
    Does anyone have a better way to do this? Or do I have to log into ZCC and launch the "Remote Management Listener" from there?

    Originally Posted by mcdonalj
    I want to be able to start the nzrViewer in listen mode when I log into windows and then be able to accept an invite for a collaboration session. When I added a shortcut to the "nzrViewer.exe /listen 5550" to my Startup Folder, it launches the Remote Listener just fine, but when I someone invites me to collaborate a Remote Session, I get an error message "Ticket not provided for Rights Authentication."
    I believe that the problem is when I launch the Viewer from the command line, I'm not authenticated to the Zen server, so it can't verify my Rights.
    Does anyone have a better way to do this? Or do I have to log into ZCC and launch the "Remote Management Listener" from there?
    There has been some updates in the documentation for 10.2.2 about remote control from cmd line.
    Check it out, maybe there is a solution to your problem.
    http://www.novell.com/documentation/...a/bcfqcen.html
    http://www.novell.com/documentation/...a/bn8ptx7.html
    Thomas

  • Problem with running a java program from the command line

    I have this code:
    package pkg;
    import jxl.*;
    import java.io.File;
    public class TestClass {
         public static void main(String[] args) {
              try{
                   Workbook book = Workbook.getWorkbook(new File("d:/testWorkspace/excFile.xls"));
                   Sheet sheet = book.getSheet(0);
                   String s=sheet.getCell(4, 2).getContents();
                   System.out.println(s);     
              }catch (Exception e){System.err.println(e);}
    }I've wrote it in Eclipse, added jxl.jar to the buildpath, and it works fine.
    Then I tried to run it from the command line and I did it like this:
    D:\testWorkspace\testProject\bin> java -cp \jxl.jar pkg.TestClassThe result was:
    Exception in thread "main" java.lang.NoClassDefFoundError: pkg/TestClass
    Caused by: java.lang.ClassNotFoundException: pkg.TestClass
    ...but the file TestClass.class DOES exist in the folder d:\testWorkspace\testProject\bin\pkg\ and the file jxl.jar IS on the root of drive D (like I already wrote, it worked fine inside the Eclipse).
    So, my question is: How to run this code from the command line?
    I have no idea what went wrong.
    Can someone help me, please?

    The current directory is not implied in the classpath.
    D:\testWorkspace\testProject\bin> java -cp .;d:\ pkg.TestClassor
    D:\testWorkspace\testProject\bin> java -cp .;d:\jxl.jar pkg.TestClassI always forget which is right since I never work with jars...

  • How to execute unix command line from cocoa?

    how to execute unix command line from cocoa?
    for example, if I want to call "ping" from cocoa, how should I do it? and how can I obtain the return value?
    thank you.
    Power G5 Quad Mac OS X (10.4.3)

    The following article may also help:
    http://cocoadevcentral.com/articles/000025.php
    Mihalis.
    Dual G5 @ 2GHz   Mac OS X (10.4.6)  

  • Help Please: How to invoke unix command lines from java?

    I have read past topics. Those are really helpful, but I still haven't got my job done. I tried the following:
    String command1 = "ls -la > ls1.txt";
    Runtime.getRuntime().exec(command1);
    String command2 = "tcsh -c ls -la > ls2.txt";
    Runtime.getRuntime().exec(command2);
    String command4 = "cp keywords.txt copyversion1.txt";
    Runtime.getRuntime().exec(command4);
    String command5 = "tcsh -c cp keywords.txt copyversion2.txt";
    Runtime.getRuntime().exec(command5);
    String command6 = "tcsh -c 'cp keywords.txt copyversion3.txt'";
    Runtime.getRuntime().exec(command6);
    Only "command4" works. Any input will be greatly appreciated.

    Thank you very much Gautam. Your solution certainly works. If you don't mind, I would like to ask you (or anybody who is willing to answer) something else. I am trying to run other types of unix command lines as well. I thought that the format you gave would work for everything. But it doesn't seem so:
    String command1[] = {"tcsh", "-c", "ls -la > ls1.txt "}; // this works as you suggested
    Runtime.getRuntime().exec(command1);
    String command12[] = {"tcsh", "-c", "lynx -dump http://www.yahoo.com > webpage.txt"}; //working fine.
    Runtime.getRuntime().exec(command12);
    String command10[] = {"tcsh", "-c", "ngram-count -text keywords.txt -lm LM10 &"}; //doesn't work
    Runtime.getRuntime().exec(command10);
    String command[] = {"tcsh", "-c", "/u/drspeech/sun4/bin/ngram-count -text keywords.txt -lm LM0 &"}; // doesn't work
    Runtime.getRuntime().exec(command);
    String command13[] = {"tcsh", "-c", "ngc -text keywords.txt -lm LM13"}; // doesn't work
    Runtime.getRuntime().exec(command13);
    String command8 = "ngram-count -text keywords.txt -lm LM8 &"; //doesn't work
    Runtime.getRuntime().exec(command8);
    String command9 = "/u/drspeech/sun4/bin/ngram-count -text keywords.txt -lm LM9 &"; //doesn't work
    Runtime.getRuntime().exec(command9);
    I tried "commandd1" and "command12". Those worked fine. No problemo. However, there's someting else I need to get done for my job; that is "command10". But it just didn't work. I thought maybe, it's because "ngram-count" is not part of the standard UNIX commands. So, I thought I might just add another alias for it in the ".cshrc" file and call it "ngc" instead. Then I tried to call the alias "ngc" instead. But it didn't work also. Then I thought, maybe, I should call it by referencing it from its original directory "/u/drspeech/sun4/bin/ngram-count". That didn't work either. I tried a couple of other combinations. None worked. I would really like to see how to solve this.

  • Invoking XSLT from the Command Line with JRE1.4 and JRE1.5

    When I invoke XSLT from the Windows Command Line with "java.exe org.apache.xalan.xslt.Process -IN OldFile.xml -XSL StyleSheet.xsl -OUT NewFile.xml" it worked fine with JRE1.4.
    Then I installed JRE1.5.0_09. The class "org.apache.xalan.xslt.Process" was moved to "com.sun.org.apache.xalan.internal.xslt.Process". But when I call it with "java.exe com.sun.org.apache.xalan.internal.xslt.Process -IN OldFile.xml -XSL StyleSheet.xsl -OUT NewFile.xml" I get the error "Exception in thread "main" java.lang.NoSuchMethodError: main". When I look into the Process class there is no "main", but a "public static void _main(String argv[])".
    The "JAXP Compatibility Guide for the J2SE Platform, versions 1.4 and 1.5" on "http://java.sun.com/webservices/docs/1.6/jaxp/JAXP-Compatibility_150.html" chapter "Invoking XSLT from the Command Line" claims it should work.
    Is there no more chance to invoke XSLT from the Windows Command Line? Why is "main" renamed to "_main"? Is the documentation wrong or is this a bug?

    When I invoke XSLT from the Windows Command Line with "java.exe org.apache.xalan.xslt.Process -IN OldFile.xml -XSL StyleSheet.xsl -OUT NewFile.xml" it worked fine with JRE1.4.
    Then I installed JRE1.5.0_09. The class "org.apache.xalan.xslt.Process" was moved to "com.sun.org.apache.xalan.internal.xslt.Process". But when I call it with "java.exe com.sun.org.apache.xalan.internal.xslt.Process -IN OldFile.xml -XSL StyleSheet.xsl -OUT NewFile.xml" I get the error "Exception in thread "main" java.lang.NoSuchMethodError: main". When I look into the Process class there is no "main", but a "public static void _main(String argv[])".
    The "JAXP Compatibility Guide for the J2SE Platform, versions 1.4 and 1.5" on "http://java.sun.com/webservices/docs/1.6/jaxp/JAXP-Compatibility_150.html" chapter "Invoking XSLT from the Command Line" claims it should work.
    Is there no more chance to invoke XSLT from the Windows Command Line? Why is "main" renamed to "_main"? Is the documentation wrong or is this a bug?

  • Unable to run reports from the unix command line

    hi
    all of a sudden i am unable to run reports ( on App server 10g) either from the unix scripts or from the unix command line. But i can run them from the forms.
    Any one have any idead about this.
    Thank you

    thanks all for replying
    i have set the env variables for the session and it worked. Looks like i have to set the oracle_home and ld_library_path every time ( opening a new putty session) i call sqlldr.
    But in a whole i am trying to run sql loader from the forms. Right now we have Oracle app server 10g which forms 10g version. As oracle app server 10g didnt come with sqlldr, we are copied the sqlldr of database on to app server with different home. after this we can run sqlldr ( on app server ) from unix scripts but not from Forms. Then we opened a qurey with oracle about app server 10g not commig with sqlldr and its remedy . But they said that they dont have specific remedy for that and suggested the same what we did.
    So we came up with java package which does the same funtion as host command and trying to run sqlldr which is on the database( ie replacing the host command in the forms with the database funtion). By using that funtion i am able to run the sqlldr from sql plus but not from forms. I couldnt easily debug it as i wont through any error messages.
    Any one have any idea of this ...
    Thank you

  • How can I import eex files into Applications EUL from the unix command line

    How can I import *.eex and *.dis files into an Applications EUL from the unix command line?
    Thanks

    Hi
    The simple answer is you either have to use the client tool DIS51ADM to import files using the command line (Discoverer Admin is a windows only client tool), or the Java command line which needs a browser.
    In theory if you have a browser running on your Unix box you may be able to use the Java command line to make this work.
    Best wishes
    Michael

  • Batch/script from command line and crontab

    Is possible to create a batch from adobe photoshop 5.5 and use a command line to execute? I need easy batch like "open and save in another kind of extension" but can't find the solution to automate the process from command line.
    Any1 can help me?
    Thank u all

    It sounds like droplets are exactly what you need.  Droplets turn any action into an executable that can be run from the command line passing files to process as arguments.  Just make the action you described, and go to go to file > automate > create droplet in photoshop to make the droplet.
    P.S. this has nothing to do with bridge

Maybe you are looking for

  • Firewall Settings (text block)

    It seems that the bbc 9300 firewall doesn't have the option to turn off SMS & MMS as individual settings like other BB devices. They are both under the same category of TEXT MESSAGE OPTIONS include: "text messages" "PIN" "personal email" "enterprise

  • Win 7 Pro error R6034 after itunes 11.4

    I just installed itunes 11.4 on my Win 7 Pro system, which has all patches up to date.  After installing, all itunes services and itunes itself get the following error: application has made an attempt to load the C runtime library incorrectly.  (I *d

  • Media Manager SUCKS! Help

    Ok so i've had my 8300 Curve for sometime now. I have a Windows xp 2gig ram and a P3 processer. I have a really decent computer that does pretty much everything. HOWEVER! When i load up my Desktop Manager and click on Media Manager.... Media Manager

  • Batchnumber in AR-Salesorder document layout??

    Hi, I'am looking for the batchnum field to select in the layout of the AR salesorder in B1?? I see serialnumber but need batchnumber of the selected item in the itemrow. I don't want to use 2 separate print outs!!! thx Mark Edited by: M. Hageman on J

  • An Exception.java is generated when use wsa.jar

    I used wsa.jar(version:10.1.3) to parse WSDL file: http://api.rakuten.co.jp/rws/soap/GenreSearch/2007-04-11?wsdl ,and the generated java files contains Exception.java. The Exception.java file is looks like: public class Exception extends Exception {.