From where is my script started on reboot

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











up vote
1
down vote

favorite












Before some days I wrote a script and put it somewhere to get it started automatically on booting on my raspberry with wheezy.



ps -ax gives me:



 2041 ? S 0:00 /usr/sbin/apache2 -k start
2064 ? Ss 0:00 /usr/sbin/cron
2067 ? S 0:00 /USR/SBIN/CRON
2068 ? S 0:00 /USR/SBIN/CRON
2072 ? Ss 0:00 /bin/sh -c eibd -t 1023 -S -D -R -T -i --no-tunnel-cl...
2073 ? Ss 0:00 /bin/sh -c python2.7 /opt/scripts/nibe_uplink/main.py
2074 ? S 0:00 eibd -t 1023 -S -D -R -T -i --no-tunnel-client-queuin...
2075 ? Rl 1:25 python2.7 /opt/scripts/nibe_uplink/main.py


pid 2074 is started from /etc/crontab.
pid 2075 is started from crontab -e



How can I find where pid 2073 is started from?










share|improve this question









New contributor




Tobias M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 2




    What do you mean by "located" and "where is it started"? Do you want to find out the working directory of your script? Please be more precise.
    – Panki
    2 hours ago














up vote
1
down vote

favorite












Before some days I wrote a script and put it somewhere to get it started automatically on booting on my raspberry with wheezy.



ps -ax gives me:



 2041 ? S 0:00 /usr/sbin/apache2 -k start
2064 ? Ss 0:00 /usr/sbin/cron
2067 ? S 0:00 /USR/SBIN/CRON
2068 ? S 0:00 /USR/SBIN/CRON
2072 ? Ss 0:00 /bin/sh -c eibd -t 1023 -S -D -R -T -i --no-tunnel-cl...
2073 ? Ss 0:00 /bin/sh -c python2.7 /opt/scripts/nibe_uplink/main.py
2074 ? S 0:00 eibd -t 1023 -S -D -R -T -i --no-tunnel-client-queuin...
2075 ? Rl 1:25 python2.7 /opt/scripts/nibe_uplink/main.py


pid 2074 is started from /etc/crontab.
pid 2075 is started from crontab -e



How can I find where pid 2073 is started from?










share|improve this question









New contributor




Tobias M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 2




    What do you mean by "located" and "where is it started"? Do you want to find out the working directory of your script? Please be more precise.
    – Panki
    2 hours ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











Before some days I wrote a script and put it somewhere to get it started automatically on booting on my raspberry with wheezy.



ps -ax gives me:



 2041 ? S 0:00 /usr/sbin/apache2 -k start
2064 ? Ss 0:00 /usr/sbin/cron
2067 ? S 0:00 /USR/SBIN/CRON
2068 ? S 0:00 /USR/SBIN/CRON
2072 ? Ss 0:00 /bin/sh -c eibd -t 1023 -S -D -R -T -i --no-tunnel-cl...
2073 ? Ss 0:00 /bin/sh -c python2.7 /opt/scripts/nibe_uplink/main.py
2074 ? S 0:00 eibd -t 1023 -S -D -R -T -i --no-tunnel-client-queuin...
2075 ? Rl 1:25 python2.7 /opt/scripts/nibe_uplink/main.py


pid 2074 is started from /etc/crontab.
pid 2075 is started from crontab -e



How can I find where pid 2073 is started from?










share|improve this question









New contributor




Tobias M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











Before some days I wrote a script and put it somewhere to get it started automatically on booting on my raspberry with wheezy.



ps -ax gives me:



 2041 ? S 0:00 /usr/sbin/apache2 -k start
2064 ? Ss 0:00 /usr/sbin/cron
2067 ? S 0:00 /USR/SBIN/CRON
2068 ? S 0:00 /USR/SBIN/CRON
2072 ? Ss 0:00 /bin/sh -c eibd -t 1023 -S -D -R -T -i --no-tunnel-cl...
2073 ? Ss 0:00 /bin/sh -c python2.7 /opt/scripts/nibe_uplink/main.py
2074 ? S 0:00 eibd -t 1023 -S -D -R -T -i --no-tunnel-client-queuin...
2075 ? Rl 1:25 python2.7 /opt/scripts/nibe_uplink/main.py


pid 2074 is started from /etc/crontab.
pid 2075 is started from crontab -e



How can I find where pid 2073 is started from?







cron raspbian ps






share|improve this question









New contributor




Tobias M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Tobias M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 1 hour ago





















New contributor




Tobias M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 hours ago









Tobias M.

83




83




New contributor




Tobias M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Tobias M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Tobias M. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 2




    What do you mean by "located" and "where is it started"? Do you want to find out the working directory of your script? Please be more precise.
    – Panki
    2 hours ago












  • 2




    What do you mean by "located" and "where is it started"? Do you want to find out the working directory of your script? Please be more precise.
    – Panki
    2 hours ago







2




2




What do you mean by "located" and "where is it started"? Do you want to find out the working directory of your script? Please be more precise.
– Panki
2 hours ago




What do you mean by "located" and "where is it started"? Do you want to find out the working directory of your script? Please be more precise.
– Panki
2 hours ago










2 Answers
2






active

oldest

votes

















up vote
3
down vote



accepted










What started this process?



You can use ps to find the parent of each process, either by adding -l (ps -axl) to give "long" output, or by specifically requesting the ppid:



ps -o ppid 2074
PPID
2072


Repeat for 2072 to see what started that (probably CRON).



Why two processes?



cron passes each command to a shell. From crontab(5):




The entire command portion of the line, up to a newline or a
"%" character, will be executed by /bin/sh or by the shell specified
in the SHELL variable of the cronfile.




If you have the following line in crontab:



0 * * * * python2.7 /opt/some/script.py


...then when the entry needs to run (every hour, on the hour), cron executes the shell (/bin/sh) with the two arguments -c and python2.7 /opt/some/script.py.



The shell then interprets everything the item after '-c' as a command to run. It finds python2.7 from PATH, and executes it with the single argument /opt/some/script.py. So, depending on your shell (including what /bin/sh points to), there may now be two processes running:



  • /bin/sh -c python2.7 /opt/some/script.py

  • /usr/bin/python2.7 /opt/some/script.py

That's why ps is showing you 2 eibd processes, and 2 python2.7 ones, despite there being only one entry for each in your crontab.



Some shells may avoid forking a second process like this. See Why is there no apparent clone or fork in simple bash command and how it's done?






share|improve this answer






















  • The icing on this particular cake can be found at unix.stackexchange.com/questions/466496 . So this is definitely not the Bourne Again shell, and is most likely the default /bin/sh, the Debian Almquist shell.
    – JdeBP
    39 mins ago











  • Thank you very much for clarification. I thought there were two separate processes. The hint with PPID was very helpful. The chain for eibd is e.g.: 2074 -> 2072 -> 2067 -> 2064 -> 1 (init) -> 0
    – Tobias M.
    31 mins ago










  • @JdeBP Good find, thankyou; edited to include a note about that.
    – JigglyNaga
    12 mins ago

















up vote
0
down vote













Reading this link tells me that there are multiple ways to run scripts on boot for the raspberry pi. In summation they are:



  1. rc.local

  2. .bashrc

  3. init.d directory

  4. SYSTEMD

  5. crontab

Seeing as you've already checked cron try looking at 1-4.






share|improve this answer








New contributor




Beans is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    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: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    Tobias M. is a new contributor. Be nice, and check out our Code of Conduct.









     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473166%2ffrom-where-is-my-script-started-on-reboot%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote



    accepted










    What started this process?



    You can use ps to find the parent of each process, either by adding -l (ps -axl) to give "long" output, or by specifically requesting the ppid:



    ps -o ppid 2074
    PPID
    2072


    Repeat for 2072 to see what started that (probably CRON).



    Why two processes?



    cron passes each command to a shell. From crontab(5):




    The entire command portion of the line, up to a newline or a
    "%" character, will be executed by /bin/sh or by the shell specified
    in the SHELL variable of the cronfile.




    If you have the following line in crontab:



    0 * * * * python2.7 /opt/some/script.py


    ...then when the entry needs to run (every hour, on the hour), cron executes the shell (/bin/sh) with the two arguments -c and python2.7 /opt/some/script.py.



    The shell then interprets everything the item after '-c' as a command to run. It finds python2.7 from PATH, and executes it with the single argument /opt/some/script.py. So, depending on your shell (including what /bin/sh points to), there may now be two processes running:



    • /bin/sh -c python2.7 /opt/some/script.py

    • /usr/bin/python2.7 /opt/some/script.py

    That's why ps is showing you 2 eibd processes, and 2 python2.7 ones, despite there being only one entry for each in your crontab.



    Some shells may avoid forking a second process like this. See Why is there no apparent clone or fork in simple bash command and how it's done?






    share|improve this answer






















    • The icing on this particular cake can be found at unix.stackexchange.com/questions/466496 . So this is definitely not the Bourne Again shell, and is most likely the default /bin/sh, the Debian Almquist shell.
      – JdeBP
      39 mins ago











    • Thank you very much for clarification. I thought there were two separate processes. The hint with PPID was very helpful. The chain for eibd is e.g.: 2074 -> 2072 -> 2067 -> 2064 -> 1 (init) -> 0
      – Tobias M.
      31 mins ago










    • @JdeBP Good find, thankyou; edited to include a note about that.
      – JigglyNaga
      12 mins ago














    up vote
    3
    down vote



    accepted










    What started this process?



    You can use ps to find the parent of each process, either by adding -l (ps -axl) to give "long" output, or by specifically requesting the ppid:



    ps -o ppid 2074
    PPID
    2072


    Repeat for 2072 to see what started that (probably CRON).



    Why two processes?



    cron passes each command to a shell. From crontab(5):




    The entire command portion of the line, up to a newline or a
    "%" character, will be executed by /bin/sh or by the shell specified
    in the SHELL variable of the cronfile.




    If you have the following line in crontab:



    0 * * * * python2.7 /opt/some/script.py


    ...then when the entry needs to run (every hour, on the hour), cron executes the shell (/bin/sh) with the two arguments -c and python2.7 /opt/some/script.py.



    The shell then interprets everything the item after '-c' as a command to run. It finds python2.7 from PATH, and executes it with the single argument /opt/some/script.py. So, depending on your shell (including what /bin/sh points to), there may now be two processes running:



    • /bin/sh -c python2.7 /opt/some/script.py

    • /usr/bin/python2.7 /opt/some/script.py

    That's why ps is showing you 2 eibd processes, and 2 python2.7 ones, despite there being only one entry for each in your crontab.



    Some shells may avoid forking a second process like this. See Why is there no apparent clone or fork in simple bash command and how it's done?






    share|improve this answer






















    • The icing on this particular cake can be found at unix.stackexchange.com/questions/466496 . So this is definitely not the Bourne Again shell, and is most likely the default /bin/sh, the Debian Almquist shell.
      – JdeBP
      39 mins ago











    • Thank you very much for clarification. I thought there were two separate processes. The hint with PPID was very helpful. The chain for eibd is e.g.: 2074 -> 2072 -> 2067 -> 2064 -> 1 (init) -> 0
      – Tobias M.
      31 mins ago










    • @JdeBP Good find, thankyou; edited to include a note about that.
      – JigglyNaga
      12 mins ago












    up vote
    3
    down vote



    accepted







    up vote
    3
    down vote



    accepted






    What started this process?



    You can use ps to find the parent of each process, either by adding -l (ps -axl) to give "long" output, or by specifically requesting the ppid:



    ps -o ppid 2074
    PPID
    2072


    Repeat for 2072 to see what started that (probably CRON).



    Why two processes?



    cron passes each command to a shell. From crontab(5):




    The entire command portion of the line, up to a newline or a
    "%" character, will be executed by /bin/sh or by the shell specified
    in the SHELL variable of the cronfile.




    If you have the following line in crontab:



    0 * * * * python2.7 /opt/some/script.py


    ...then when the entry needs to run (every hour, on the hour), cron executes the shell (/bin/sh) with the two arguments -c and python2.7 /opt/some/script.py.



    The shell then interprets everything the item after '-c' as a command to run. It finds python2.7 from PATH, and executes it with the single argument /opt/some/script.py. So, depending on your shell (including what /bin/sh points to), there may now be two processes running:



    • /bin/sh -c python2.7 /opt/some/script.py

    • /usr/bin/python2.7 /opt/some/script.py

    That's why ps is showing you 2 eibd processes, and 2 python2.7 ones, despite there being only one entry for each in your crontab.



    Some shells may avoid forking a second process like this. See Why is there no apparent clone or fork in simple bash command and how it's done?






    share|improve this answer














    What started this process?



    You can use ps to find the parent of each process, either by adding -l (ps -axl) to give "long" output, or by specifically requesting the ppid:



    ps -o ppid 2074
    PPID
    2072


    Repeat for 2072 to see what started that (probably CRON).



    Why two processes?



    cron passes each command to a shell. From crontab(5):




    The entire command portion of the line, up to a newline or a
    "%" character, will be executed by /bin/sh or by the shell specified
    in the SHELL variable of the cronfile.




    If you have the following line in crontab:



    0 * * * * python2.7 /opt/some/script.py


    ...then when the entry needs to run (every hour, on the hour), cron executes the shell (/bin/sh) with the two arguments -c and python2.7 /opt/some/script.py.



    The shell then interprets everything the item after '-c' as a command to run. It finds python2.7 from PATH, and executes it with the single argument /opt/some/script.py. So, depending on your shell (including what /bin/sh points to), there may now be two processes running:



    • /bin/sh -c python2.7 /opt/some/script.py

    • /usr/bin/python2.7 /opt/some/script.py

    That's why ps is showing you 2 eibd processes, and 2 python2.7 ones, despite there being only one entry for each in your crontab.



    Some shells may avoid forking a second process like this. See Why is there no apparent clone or fork in simple bash command and how it's done?







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 14 mins ago

























    answered 2 hours ago









    JigglyNaga

    3,003624




    3,003624











    • The icing on this particular cake can be found at unix.stackexchange.com/questions/466496 . So this is definitely not the Bourne Again shell, and is most likely the default /bin/sh, the Debian Almquist shell.
      – JdeBP
      39 mins ago











    • Thank you very much for clarification. I thought there were two separate processes. The hint with PPID was very helpful. The chain for eibd is e.g.: 2074 -> 2072 -> 2067 -> 2064 -> 1 (init) -> 0
      – Tobias M.
      31 mins ago










    • @JdeBP Good find, thankyou; edited to include a note about that.
      – JigglyNaga
      12 mins ago
















    • The icing on this particular cake can be found at unix.stackexchange.com/questions/466496 . So this is definitely not the Bourne Again shell, and is most likely the default /bin/sh, the Debian Almquist shell.
      – JdeBP
      39 mins ago











    • Thank you very much for clarification. I thought there were two separate processes. The hint with PPID was very helpful. The chain for eibd is e.g.: 2074 -> 2072 -> 2067 -> 2064 -> 1 (init) -> 0
      – Tobias M.
      31 mins ago










    • @JdeBP Good find, thankyou; edited to include a note about that.
      – JigglyNaga
      12 mins ago















    The icing on this particular cake can be found at unix.stackexchange.com/questions/466496 . So this is definitely not the Bourne Again shell, and is most likely the default /bin/sh, the Debian Almquist shell.
    – JdeBP
    39 mins ago





    The icing on this particular cake can be found at unix.stackexchange.com/questions/466496 . So this is definitely not the Bourne Again shell, and is most likely the default /bin/sh, the Debian Almquist shell.
    – JdeBP
    39 mins ago













    Thank you very much for clarification. I thought there were two separate processes. The hint with PPID was very helpful. The chain for eibd is e.g.: 2074 -> 2072 -> 2067 -> 2064 -> 1 (init) -> 0
    – Tobias M.
    31 mins ago




    Thank you very much for clarification. I thought there were two separate processes. The hint with PPID was very helpful. The chain for eibd is e.g.: 2074 -> 2072 -> 2067 -> 2064 -> 1 (init) -> 0
    – Tobias M.
    31 mins ago












    @JdeBP Good find, thankyou; edited to include a note about that.
    – JigglyNaga
    12 mins ago




    @JdeBP Good find, thankyou; edited to include a note about that.
    – JigglyNaga
    12 mins ago












    up vote
    0
    down vote













    Reading this link tells me that there are multiple ways to run scripts on boot for the raspberry pi. In summation they are:



    1. rc.local

    2. .bashrc

    3. init.d directory

    4. SYSTEMD

    5. crontab

    Seeing as you've already checked cron try looking at 1-4.






    share|improve this answer








    New contributor




    Beans is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      0
      down vote













      Reading this link tells me that there are multiple ways to run scripts on boot for the raspberry pi. In summation they are:



      1. rc.local

      2. .bashrc

      3. init.d directory

      4. SYSTEMD

      5. crontab

      Seeing as you've already checked cron try looking at 1-4.






      share|improve this answer








      New contributor




      Beans is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.



















        up vote
        0
        down vote










        up vote
        0
        down vote









        Reading this link tells me that there are multiple ways to run scripts on boot for the raspberry pi. In summation they are:



        1. rc.local

        2. .bashrc

        3. init.d directory

        4. SYSTEMD

        5. crontab

        Seeing as you've already checked cron try looking at 1-4.






        share|improve this answer








        New contributor




        Beans is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        Reading this link tells me that there are multiple ways to run scripts on boot for the raspberry pi. In summation they are:



        1. rc.local

        2. .bashrc

        3. init.d directory

        4. SYSTEMD

        5. crontab

        Seeing as you've already checked cron try looking at 1-4.







        share|improve this answer








        New contributor




        Beans is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        Beans is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 2 hours ago









        Beans

        11




        11




        New contributor




        Beans is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Beans is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Beans is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.




















            Tobias M. is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            Tobias M. is a new contributor. Be nice, and check out our Code of Conduct.












            Tobias M. is a new contributor. Be nice, and check out our Code of Conduct.











            Tobias M. is a new contributor. Be nice, and check out our Code of Conduct.













             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473166%2ffrom-where-is-my-script-started-on-reboot%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            Long meetings (6-7 hours a day): Being “babysat” by supervisor

            Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

            Confectionery