I have this script meant to run when booting (named bootMF):
!/bin/bash
cd /media/pi/2E2D-29D01
sleep 120
python3 telnetRX006RBN.py &
sleep 10
python3 telnetRX006DXK.py &
sleep 70
python3 analyse039.py &
sleep 60
python3 WatchDog002.py &
exit
I inserted this line in .profile:
(sleep 15 && /home/pi/bootMF) &
Now when I reboot with 'shutdown -r now' all python scripts are started twice as you can see here:
pi@raspberrypi:~ $ ps -ef | grep python
pi 1470 1 0 15:41 ? 00:00:02 python3 telnetRX006RBN.py
pi 1472 1 0 15:41 tty1 00:00:01 python3 telnetRX006RBN.py
pi 1474 1 0 15:42 ? 00:00:00 python3 telnetRX006DXK.py
pi 1476 1 0 15:42 tty1 00:00:00 python3 telnetRX006DXK.py
pi 1478 1 14 15:43 ? 00:01:20 python3 analyse039.py
pi 1480 1 14 15:43 tty1 00:01:21 python3 analyse039.py
pi 1496 1 0 15:44 ? 00:00:00 python3 WatchDog002.py
pi 1497 1 0 15:44 tty1 00:00:00 python3 WatchDog002.py
pi 1594 1446 0 15:52 pts/0 00:00:00 grep --color=auto python
Can anyone tell me why they are started twice? When I run bootMF manually using 'bash bootMF' they only start once.
.profile
is a (no offense) dumb place to start one-off services as it is not something which is guaranteed to be loaded only once. SeeINVOCATION
underman bash
..profile
and added it torc.local
. Seems to work better now.