Upstart running python script











up vote
0
down vote

favorite












Ubuntu 14.04



I have simple upstart job test.conf:



root@ubuntutest:~# cat /etc/init/test.conf 
expect fork
script
/root/test.py
end script


and simple python script /root/test.py:



root@ubuntutest:~# cat /root/test.py 
#!/usr/bin/python
import time

print("Hello, World")
time.sleep(30)
print("Goodbye")


I start test job, ensure that upstart tracks proper PID, wait script's termination, but than upstart doesn't stop tracking non-existing PID. So i'm not able top stop this job:



root@ubuntutest:~# initctl status test
test stop/waiting
root@ubuntutest:~# initctl start test
test start/running, process 1859
root@ubuntutest:~# ps aux | grep 1859
root 1859 0.2 0.7 29832 7188 ? S 14:43 0:00 /usr/bin/python /root/test.py
root 1862 0.0 0.2 11760 2156 pts/0 S+ 14:43 0:00 grep --color=auto 1859
root@ubuntutest:~# ps aux | grep 1859
root 1864 0.0 0.2 11760 2224 pts/0 S+ 14:43 0:00 grep --color=auto 1859
root@ubuntutest:~# initctl status test
test start/running, process 1859


If i delete expect fork from test job then everything works good (except upstart tracks sh instead of python) - i want to understand what's wrong with my code?



The same happens if i use bash script instead of python:



#!/bin/bash

sleep 30


Upstart shows that test job is always running (even when the script ends)










share|improve this question




























    up vote
    0
    down vote

    favorite












    Ubuntu 14.04



    I have simple upstart job test.conf:



    root@ubuntutest:~# cat /etc/init/test.conf 
    expect fork
    script
    /root/test.py
    end script


    and simple python script /root/test.py:



    root@ubuntutest:~# cat /root/test.py 
    #!/usr/bin/python
    import time

    print("Hello, World")
    time.sleep(30)
    print("Goodbye")


    I start test job, ensure that upstart tracks proper PID, wait script's termination, but than upstart doesn't stop tracking non-existing PID. So i'm not able top stop this job:



    root@ubuntutest:~# initctl status test
    test stop/waiting
    root@ubuntutest:~# initctl start test
    test start/running, process 1859
    root@ubuntutest:~# ps aux | grep 1859
    root 1859 0.2 0.7 29832 7188 ? S 14:43 0:00 /usr/bin/python /root/test.py
    root 1862 0.0 0.2 11760 2156 pts/0 S+ 14:43 0:00 grep --color=auto 1859
    root@ubuntutest:~# ps aux | grep 1859
    root 1864 0.0 0.2 11760 2224 pts/0 S+ 14:43 0:00 grep --color=auto 1859
    root@ubuntutest:~# initctl status test
    test start/running, process 1859


    If i delete expect fork from test job then everything works good (except upstart tracks sh instead of python) - i want to understand what's wrong with my code?



    The same happens if i use bash script instead of python:



    #!/bin/bash

    sleep 30


    Upstart shows that test job is always running (even when the script ends)










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Ubuntu 14.04



      I have simple upstart job test.conf:



      root@ubuntutest:~# cat /etc/init/test.conf 
      expect fork
      script
      /root/test.py
      end script


      and simple python script /root/test.py:



      root@ubuntutest:~# cat /root/test.py 
      #!/usr/bin/python
      import time

      print("Hello, World")
      time.sleep(30)
      print("Goodbye")


      I start test job, ensure that upstart tracks proper PID, wait script's termination, but than upstart doesn't stop tracking non-existing PID. So i'm not able top stop this job:



      root@ubuntutest:~# initctl status test
      test stop/waiting
      root@ubuntutest:~# initctl start test
      test start/running, process 1859
      root@ubuntutest:~# ps aux | grep 1859
      root 1859 0.2 0.7 29832 7188 ? S 14:43 0:00 /usr/bin/python /root/test.py
      root 1862 0.0 0.2 11760 2156 pts/0 S+ 14:43 0:00 grep --color=auto 1859
      root@ubuntutest:~# ps aux | grep 1859
      root 1864 0.0 0.2 11760 2224 pts/0 S+ 14:43 0:00 grep --color=auto 1859
      root@ubuntutest:~# initctl status test
      test start/running, process 1859


      If i delete expect fork from test job then everything works good (except upstart tracks sh instead of python) - i want to understand what's wrong with my code?



      The same happens if i use bash script instead of python:



      #!/bin/bash

      sleep 30


      Upstart shows that test job is always running (even when the script ends)










      share|improve this question















      Ubuntu 14.04



      I have simple upstart job test.conf:



      root@ubuntutest:~# cat /etc/init/test.conf 
      expect fork
      script
      /root/test.py
      end script


      and simple python script /root/test.py:



      root@ubuntutest:~# cat /root/test.py 
      #!/usr/bin/python
      import time

      print("Hello, World")
      time.sleep(30)
      print("Goodbye")


      I start test job, ensure that upstart tracks proper PID, wait script's termination, but than upstart doesn't stop tracking non-existing PID. So i'm not able top stop this job:



      root@ubuntutest:~# initctl status test
      test stop/waiting
      root@ubuntutest:~# initctl start test
      test start/running, process 1859
      root@ubuntutest:~# ps aux | grep 1859
      root 1859 0.2 0.7 29832 7188 ? S 14:43 0:00 /usr/bin/python /root/test.py
      root 1862 0.0 0.2 11760 2156 pts/0 S+ 14:43 0:00 grep --color=auto 1859
      root@ubuntutest:~# ps aux | grep 1859
      root 1864 0.0 0.2 11760 2224 pts/0 S+ 14:43 0:00 grep --color=auto 1859
      root@ubuntutest:~# initctl status test
      test start/running, process 1859


      If i delete expect fork from test job then everything works good (except upstart tracks sh instead of python) - i want to understand what's wrong with my code?



      The same happens if i use bash script instead of python:



      #!/bin/bash

      sleep 30


      Upstart shows that test job is always running (even when the script ends)







      scripts python upstart






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 at 12:44

























      asked Nov 15 at 11:51









      stepanov.dmit

      12




      12



























          active

          oldest

          votes











          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: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          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%2f1093155%2fupstart-running-python-script%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1093155%2fupstart-running-python-script%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?