From where is my script started on reboot
Clash Royale CLAN TAG#URR8PPP
up vote
2
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?
cron raspbian ps
New contributor
add a comment |Â
up vote
2
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?
cron raspbian ps
New contributor
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
Oct 4 at 8:43
add a comment |Â
up vote
2
down vote
favorite
up vote
2
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?
cron raspbian ps
New contributor
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
cron raspbian ps
New contributor
New contributor
edited Oct 4 at 10:22
New contributor
asked Oct 4 at 8:33
Tobias M.
133
133
New contributor
New contributor
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
Oct 4 at 8:43
add a comment |Â
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
Oct 4 at 8:43
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
Oct 4 at 8:43
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
Oct 4 at 8:43
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
4
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?
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
Oct 4 at 10:45
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.
Oct 4 at 10:53
@JdeBP Good find, thankyou; edited to include a note about that.
â JigglyNaga
Oct 4 at 11:12
add a comment |Â
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:
- rc.local
- .bashrc
- init.d directory
- SYSTEMD
- crontab
Seeing as you've already checked cron try looking at 1-4.
New contributor
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
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?
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
Oct 4 at 10:45
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.
Oct 4 at 10:53
@JdeBP Good find, thankyou; edited to include a note about that.
â JigglyNaga
Oct 4 at 11:12
add a comment |Â
up vote
4
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?
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
Oct 4 at 10:45
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.
Oct 4 at 10:53
@JdeBP Good find, thankyou; edited to include a note about that.
â JigglyNaga
Oct 4 at 11:12
add a comment |Â
up vote
4
down vote
accepted
up vote
4
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?
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?
edited Oct 4 at 11:11
answered Oct 4 at 9:21
JigglyNaga
3,062626
3,062626
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
Oct 4 at 10:45
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.
Oct 4 at 10:53
@JdeBP Good find, thankyou; edited to include a note about that.
â JigglyNaga
Oct 4 at 11:12
add a comment |Â
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
Oct 4 at 10:45
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.
Oct 4 at 10:53
@JdeBP Good find, thankyou; edited to include a note about that.
â JigglyNaga
Oct 4 at 11:12
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
Oct 4 at 10:45
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
Oct 4 at 10:45
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.
Oct 4 at 10:53
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.
Oct 4 at 10:53
@JdeBP Good find, thankyou; edited to include a note about that.
â JigglyNaga
Oct 4 at 11:12
@JdeBP Good find, thankyou; edited to include a note about that.
â JigglyNaga
Oct 4 at 11:12
add a comment |Â
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:
- rc.local
- .bashrc
- init.d directory
- SYSTEMD
- crontab
Seeing as you've already checked cron try looking at 1-4.
New contributor
add a comment |Â
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:
- rc.local
- .bashrc
- init.d directory
- SYSTEMD
- crontab
Seeing as you've already checked cron try looking at 1-4.
New contributor
add a comment |Â
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:
- rc.local
- .bashrc
- init.d directory
- SYSTEMD
- crontab
Seeing as you've already checked cron try looking at 1-4.
New contributor
Reading this link tells me that there are multiple ways to run scripts on boot for the raspberry pi. In summation they are:
- rc.local
- .bashrc
- init.d directory
- SYSTEMD
- crontab
Seeing as you've already checked cron try looking at 1-4.
New contributor
New contributor
answered Oct 4 at 8:56
Beans
11
11
New contributor
New contributor
add a comment |Â
add a comment |Â
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.
Tobias M. is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Oct 4 at 8:43