Running automatically

Run your clock automatically whenever you turn on your Raspberry Pi (even if you don’t log in)!

To do this you need to edit a system file with this command:

sudo nano /etc/rc.local

Enter the following line directly above exit 0 line:

python3 /home/pi/codebug_i2c_clock.py &

Now restart your Raspberry Pi and you will see that your clock runs before you log in.

If you need to stop the clock running, type:

ps aux

And find the process that has python3 /home/pi/codebug_i2c_clock.py in the end column, and take a note of its process id (from the second column). Now run:

sudo kill -9 your-process-id

e.g:

sudo kill -9 2887

To remove your clock simply edit the rc.local file and remove the line you inserted:

sudo nano /etc/rc.local

Activities with this step

Back to top