restart program when it crashes / closes by self

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
2
down vote

favorite












Hi i am wanting to restart a program which i need to have it run 24/7 the app is minergate.



The issue I am having is that the app / program feezes and shuts down - this is a known issue with the 8.1 version.



However until 8.2 comes out I have no other option but to bite my lips and bear it. I am wondering is there away to listen for the program, and if it crashes to restart the app and continue the ETH mining?







share|improve this question




















  • Depending on how the program works, you could wrap it in a shell loop so that it gets relaunched after it exits.
    – dsstorefile1
    May 23 at 17:05














up vote
2
down vote

favorite












Hi i am wanting to restart a program which i need to have it run 24/7 the app is minergate.



The issue I am having is that the app / program feezes and shuts down - this is a known issue with the 8.1 version.



However until 8.2 comes out I have no other option but to bite my lips and bear it. I am wondering is there away to listen for the program, and if it crashes to restart the app and continue the ETH mining?







share|improve this question




















  • Depending on how the program works, you could wrap it in a shell loop so that it gets relaunched after it exits.
    – dsstorefile1
    May 23 at 17:05












up vote
2
down vote

favorite









up vote
2
down vote

favorite











Hi i am wanting to restart a program which i need to have it run 24/7 the app is minergate.



The issue I am having is that the app / program feezes and shuts down - this is a known issue with the 8.1 version.



However until 8.2 comes out I have no other option but to bite my lips and bear it. I am wondering is there away to listen for the program, and if it crashes to restart the app and continue the ETH mining?







share|improve this question












Hi i am wanting to restart a program which i need to have it run 24/7 the app is minergate.



The issue I am having is that the app / program feezes and shuts down - this is a known issue with the 8.1 version.



However until 8.2 comes out I have no other option but to bite my lips and bear it. I am wondering is there away to listen for the program, and if it crashes to restart the app and continue the ETH mining?









share|improve this question











share|improve this question




share|improve this question










asked May 23 at 16:56









RussellHarrower

1163




1163











  • Depending on how the program works, you could wrap it in a shell loop so that it gets relaunched after it exits.
    – dsstorefile1
    May 23 at 17:05
















  • Depending on how the program works, you could wrap it in a shell loop so that it gets relaunched after it exits.
    – dsstorefile1
    May 23 at 17:05















Depending on how the program works, you could wrap it in a shell loop so that it gets relaunched after it exits.
– dsstorefile1
May 23 at 17:05




Depending on how the program works, you could wrap it in a shell loop so that it gets relaunched after it exits.
– dsstorefile1
May 23 at 17:05










1 Answer
1






active

oldest

votes

















up vote
3
down vote













You can run the program as a daemon using the daemon command, which runs the program in the background, and will automatically restart it if it dies (using the --respawn option) :



daemon --name="yourservicename" --respawn --output=yourlog.txt yourprogram


To stop the daemon:



daemon --name="yourservicename" --stop


To install daemon:



sudo apt-get update
sudo apt-get install daemon





share|improve this answer






















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1039492%2frestart-program-when-it-crashes-closes-by-self%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote













    You can run the program as a daemon using the daemon command, which runs the program in the background, and will automatically restart it if it dies (using the --respawn option) :



    daemon --name="yourservicename" --respawn --output=yourlog.txt yourprogram


    To stop the daemon:



    daemon --name="yourservicename" --stop


    To install daemon:



    sudo apt-get update
    sudo apt-get install daemon





    share|improve this answer


























      up vote
      3
      down vote













      You can run the program as a daemon using the daemon command, which runs the program in the background, and will automatically restart it if it dies (using the --respawn option) :



      daemon --name="yourservicename" --respawn --output=yourlog.txt yourprogram


      To stop the daemon:



      daemon --name="yourservicename" --stop


      To install daemon:



      sudo apt-get update
      sudo apt-get install daemon





      share|improve this answer
























        up vote
        3
        down vote










        up vote
        3
        down vote









        You can run the program as a daemon using the daemon command, which runs the program in the background, and will automatically restart it if it dies (using the --respawn option) :



        daemon --name="yourservicename" --respawn --output=yourlog.txt yourprogram


        To stop the daemon:



        daemon --name="yourservicename" --stop


        To install daemon:



        sudo apt-get update
        sudo apt-get install daemon





        share|improve this answer














        You can run the program as a daemon using the daemon command, which runs the program in the background, and will automatically restart it if it dies (using the --respawn option) :



        daemon --name="yourservicename" --respawn --output=yourlog.txt yourprogram


        To stop the daemon:



        daemon --name="yourservicename" --stop


        To install daemon:



        sudo apt-get update
        sudo apt-get install daemon






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited May 23 at 21:21

























        answered May 23 at 17:20









        stumblebee

        2,2983922




        2,2983922






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1039492%2frestart-program-when-it-crashes-closes-by-self%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            Which professions warranted travel in Medieval times?

            How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

            Trouble downloading packages list due to a “Hash sum mismatch” error