Shell script to start, stop and restart a JAR under linux

Hi everyone,
Does anyone have idea to write a shell script to start, stop and restart a JAR under linux? it can also indicate a method or parameter? Thanks!
this JAR inculdes a class with main method like this:
public class Client(){
public Client(String name){
public void stopClient(){
public static void main(String[] args){
new Client("/tmp/text.log");
}

Does anyone have idea to write a shell script to
start, stop and restart a JAR under linux? That part isn't really clear.
Start would be java -jar myjar.jar.
Stop could either be kill, which kills the whole process; kill -TSTP, which suspends the process, or some application-specific communication such as sending something over a port; or putting something into a file or something.
Restart could just be the same as start (if stop is just kill); kill -CONT, if stop was kill -TSTP; or some other app-specific communication.

Similar Messages

  • Shell script to start, stop and restart a JAR

    Hi everyone,
    Does anyone have idea to write a shell script to start, stop and restart a JAR under linux? it can indicate a method or parameter? Thanks!
    this JAR inculdes a class with main method like this:
    public class Client(){
      public Client(String name){
      public void stopClient(){
      public static void main(String[] args){
         new Client("/tmp/text.log");
    }

    Does anyone have idea to write a shell script to
    start, stop and restart a JAR under linux? That part isn't really clear.
    Start would be java -jar myjar.jar.
    Stop could either be kill, which kills the whole process; kill -TSTP, which suspends the process, or some application-specific communication such as sending something over a port; or putting something into a file or something.
    Restart could just be the same as start (if stop is just kill); kill -CONT, if stop was kill -TSTP; or some other app-specific communication.

  • Shell script for start stop and restart standard

    Hi,
    I'd like to know if there's a standard template for shellscript for a kind of stop|start|restart execution of a server or stub.
    If you have any link or some info that explain how to do that nicely it would be nice!
    Thank you

    There's plenty of live examples in /etc/rc.d

  • Start, stop and restart while loops

    Hi, my qustion is i have 2 example a and example b. Example b lets u start counting up in seconds when u want to. as long as the toggle switchs are in correct position. it also lets u start, stop and restart if need be. i want to be able to that with example a, but for some reason the while loop always sets of running independent of what position the the toggle switch. Any help greatly appreciated.
    Thanks Stuart
    Attachments:
    examplealib.llb ‏202 KB
    exampleb.vi ‏25 KB

    An example as the attachment.
    Attachments:
    switch.vi ‏23 KB

  • How to start, stop and restart task

    Hello Everyone,
    Need advice on what is the correct way to start, stop and restart a Java task?
    I have tried with Executors.newCachedThreadPool() or fixedThreadPool() however I was only able to submit the task once. My program crashed when i tried to resubmit the task again after a shutdownnow command()

    Tasks are designed to be run once. If you want restart functionality, use a service:
    http://docs.oracle.com/javafx/2/api/javafx/concurrent/Service.html
    The sample service I posted in the following thread demonstrates how to do this:
    Multithreading
    Use of Executors is not necessary as a Service encapsulates the execution thread management (though you can set your own executor on the service if you really needed it). All you need to do is make use of the service start, cancel, restart and reset methods as required. If you do use the cancel method, then you need to make sure that your service is properly interrupt aware for the cancel to function as you expect.

  • How do I start, stop and restart a sequence with a periodic input?

    Hi,
    I have written some code that will monitor my com port (rs-232) continuously for an ASCII character (in this case a 'P'). When the P is received, I want a sequence structure to start working. The P will only appear once for a short while, but the sequence should carry on running until it finishes all the frames. On the next time a P appears on my monitor, I want to either stop the sequence structure regardless of which frame its in and restart the sequence from the beginning again or to run the sequence from the start again if it has already completed all the frames.
    What sort of structure do I need to do this, are there any examples?
    James

    James,
    Indiana is correct, my take on this is similiar.
    If you have a 3 element sequence structure for example which runs if 'P' is returned from your COMs thread, you will need to query a variable in each element of the sequence in order to suspend execution of the next/remaining elements in the sequence if this event occurs. You can do this by reading the variable that your COMs thread sets using a case structure in each element of your sequence. In order to re-run your sequence if 'P' is returned during the execution you can simply set the suspend variable and ensure the code is in a while loop to recall the code.
    See the attached example code/screen shot:
    This is however not an elegant solution and the best way would probably be using the events structure and a user event to queue the P events. This is available in 6.1 but I believe its the professional package. See also my implementation using this method, again attached below:
    Hope this helps,
    Kind Regards
    Steven Bird
    Applications Engineer
    National Instruments
    Attachments:
    Example.JPG ‏194 KB

  • Shell script to start forms and reports server on reboot

    Does anyone have on shell script to automatically start up the forms and reports server on unix after a reboot?
    thanks much

    I also recompiled the "test.fmb" that came with the 10g Forms and Server on my windows xp machine and when I downloaded it back to the Linux Forms and Server machine, it loss the functionality of the "OK" button which is suppose to perform "exit_form" when pressed.
    BTW, I am using 10G developer suite on windows xp.

  • Using cron to stop and restart password protected instance (App Server 7)

    I have been asked by a customer to create a cron job to stop and restart their web application running under Applications server 7.
    I have created the script and can stop the instance, but I am unable to start it as it is asking for a password.
    I have included this in the script but it doesn't seem to like having a password supplied this way.
    Am I doing something wrong or Are there any alternative ways of stopping and restarting an application, using Cron?

    Have you looked at using password.conf file as described in --
    http://docs.sun.com/source/816-7155-10/crcfgfil.html#1075615
    You might also want to look at --
    http://docs.sun.com/source/816-7156-10/agsvrprf.html#1019453

  • Redhat linux 6 VM - stop and  restart

    Hi,
    I've installed new HVM - Redhat Linux 6, standard installation. I have the problem with stop and restart initiated from the OVM console. Job is running, but the OS inside VM doesn't start the shutdown process.
    For example another VM running Oracle Linux 6 works. The same problem is with the restart and live migration - both works for Oracle Linux, but redhat no.
    Do you have an idea what are the requirements for stopping and restarting the VM from OVM console?

    DN,
    I take all your questions, don't I?
    Anyhow, this command adds your Report Server to the Oracle Process Manager and Notification Server's (opmn) and Enterprise Control:
    $OH/bin/addNewServerTarget.sh reports_server_name
    After that your Reports server will be started and stopped whenever you issue "opmnctl startall / stopall". Issue a opmnctl reload after running that script, or opmnctl restart.
    You can also start and stop it individual with: (the choice is yours)
    opmnctl startproc ias-component=reports_server_name
    opmnctl stopproc ias-component=reports_server_name
    opmnctl startproc process-type=reports_server_name
    opmnctl stopproc process-type=reports_server_name
    Check status with:
    opmnctl status

  • What is the procedure to stop and restart the Hyerion Environment

    Hi All,
    Can you kindly let me know whether the procedure that i am following below is correct to stop and restart the Hyperion Environment.
    To Stop:
    1) Essbase.
    2) Shared Services.
    3) BI+ (Financial Reporting)
    4) Planning.
    5) DB2
    To Start:
    1) DB2
    2) Shared Services.
    3) BI+ (Financial Reporting)
    4) Hyperion Planning.
    5) Essbase.
    Is the above procedure correct or do i need to do any changes to it.
    Regards,
    Krishna.

    Hi,
    I guess restarting database is not required during the process of restarting Hyperion Environment. Below order is preferable.
    Stop:
    1) Essbase Administration Services
    2) Planning
    3) BI Plus Web Apps (Workspace, Web Analysis,..)
    4) BI Plus (core)
    5) Foundation Services (License services, shared services)
    Start:
    1) Foundation Services (License services, shared services)
    2) BI Plus (core)
    3) BI Plus Web Apps (Workspace, Web Analysis,..)
    4) Essbase Administration Services
    5) Planning
    Regards,
    Sreemani

  • After upgrading, videos randomly stop and restart.

    Since upgrading to iTunes 10 purchased videos of TV shows randomly stop and restart. I've had these videos for years and never had a problem, but now every time I watch an episode it sill get around 5 minutes in and spontaneously start the episode over. Anyone else having these problems?

    Hi Fabrizio,
    why do you want to reboot your server every sunday?????
    If you reboot your SAP this often, you'll have performance problems every Monday. All
    of your SAP internal Buffers must be filled again after an reboot. If your DB is on the
    same Host, also your DB Buffer is empty.
    If this is an productive System, i highly recommend you that you not reboot your SAP System this often....
    (By side, thats the difference between an *nix and an Windows System.).
    What is the reason for doing that?
    confused
    Regards Manuel

  • Why can't I stop and restart my ipod touch OS update?

    Why can't I stop and restart my ipod touch OS update?
    I'm working in West Africa, and iTunes says it will take between 8 and 11 hours to download the OS (5.0.1). But I never have that long a stretch of uninterrupted electricity or internet. Every blink off and I have to start again at zero. Bit torrents are already an old technology. What gives? Basically, I WILL NEVER BE ABLE TO UPDATE MY IPOD. And probably not my macbook.

    Try a manual update as defined here:
    iDevice Troubleshooting 101 :: iPhone, iPad, iPod touch

  • Scripts for starting/stopping managed servers

    All,
    Could someone provide me with some sample scripts for starting/stopping managed Weblogic servers?  I'm specifically looking for ways to start/stop them WITHOUT starting the AdminServer.  I'm running WLS 10.3.6 on Windows Server 2003, and I have NodeManager set to start automatically as a Windows service.
    I know how to set my managed servers up as Windows services so that they will start automatically at boot, but this requires the AdminServer to be running, which I do not want.  I just want a few scripts for starting/stopping the managed servers (and maybe some hints as to how to make them start automatically without starting the AdminServer).
    Thanks in advance,
    Tom

    Hello Puneet,
    Admin console is an web application deployed into AdminServer. Hence if you shutdown AdminServer then you wouldn't able to access Admin console.
    Managed Server would function in MSI mode, however you will not be able to make any configuration or administration activities like deployment , any configuration changes , etc.
    Hello PRISM,
    Can you confirm your requirement about why you don't want AdminServer to be running?
    As I said,  you will loose the administration capability if you don't have admin server running.
    Regards
    Rosario

  • Stop and restart the USRP

    Hello,
    I have been trying to implement a small application for reception and analysis of radio signals. Well, I want to be able to stop and restart the record at wish. The first operation works fine; I can record and stop. However, when I try to record again, I get an error : "This operation requires the driver to be in the Running state". Although when stop recording it goes to initialize state (starting point) where it first started and worked properly. I've attached my VI to this thread.
    kind regards
    Attachments:
    Analysis.vi ‏59 KB

    Hi,
    I took a look at your VI and reproduced the problem in your VI but I tried to simplify the problem by trying to reproduce it in a smaller VI (attached).
    Please find the VI attached which starts aborts and restarts a acquisition with configuration stages in between. I could not reproduce the issue using the VI which I have attached.
    So I think there might be some very small issue in the VI which you posted.
    Thanks.
    Note: I used driver 14.0 which was recently released. Please ignore any driver specific VIs or connections.
    Attachments:
    Start Abort Restart.vi ‏20 KB

  • Any script to start Replication and Caching automatically?

    yes, I know there're two stored procedures to start Replication and Caching, ie. call ttRepStart() and
    call ttCacheStart().
    but, is there any methods, like unix shell script, to start them easily? i can't find on the installation provided.
    thanks!

    thanks! wrote it by myself:
    #!/bin/sh
    echo "starting ttCacheStart"
    LD_LIBRARY_PATH=/local/oracle/product/10.2.0/lib:/home/oracle/TimesTen/tt60/lib; export LD_LIBRARY_PATH
    TT_BIN=/home/oracle/TimesTen/tt60/bin
    #$TT_BIN/ttIsql -v 0 -connstr dsn=TT_tt60 -f cachestart.sql
    $TT_BIN/ttAdmin -cachestart dsn=TT_tt60
    returnCode=$?
    echo "return code: $returnCode"
    if test $returnCode=0 || test $returnCode=5
    then echo "Successfully started Cache"
    exit 0
    else echo "Failed in starting Cache"
    exit -1
    fi
    exit $returnCode

Maybe you are looking for

  • How do i update macbook pro 10.5.8

    as above

  • Re: Bug: Cross Connection Query not working

    hello i am using vers. 4 and i cannot get BRIDGE to work i have posted more on this here BRIDGE command in Oracle SQL Developer - Stack Overflow i would be most grateful for any help

  • Localization type in license key

    Hi All, I am generating license key for my 8.8 PL03 installation. the license key generated is correct but when i load it, my license manager shows two localization. global and Indian. my localization of company database is that of USA. I am not able

  • GTT table getting Row Exclusive lock

    I have a procedure which loads a table which is used for reporting. Currently it is a single process which picks up most of the data after joining 2-3 big tables(around 70-80GB) and then loading the main table. The joins are on PI and also partitions

  • Mixed up in airport, airport extreme and a snow B.S.

    Hello! I am trying to set up an airport base (snow) to allow me to run two macs from my DSL. My titanium DVI has the airport card that came with it (2nd generation).My iBook G4 800 has the airport card that came with it and it is a 3rd generation Air