Difference between revisions of "How to add crontab job"

From Geekworm Wiki
Jump to navigation Jump to search
Line 7: Line 7:
 
Choose "1" then press Enter
 
Choose "1" then press Enter
  
Add a line at the end of the file that reads like this:
+
Add the command line you want to execute at the end of the file that reads like this:
  
@reboot python /home/pi/x735-v2.5/pwm_fan_control.py
+
@reboot python /home/pi/x-c1/fan.py
  
or
 
 
@reboot python /home/pi/x-c1/fan.py
 
  
or
+
PS:
  
'''or any other job you want to run automatically after boot'''
+
1. '''@reboot python /home/pi/x-c1/fan.py''' is a sample command, You '''MUST''' to modify it according to your needs.
  
<span style="color:red;">Please make sure that the file path and file name are correct</span>
+
2. <span style="color:red;">Please make sure that the file path and file name are correct</span>
  
you can place the other shell command.
 
  
 
[[File:Crontab-step2.png]]
 
[[File:Crontab-step2.png]]

Revision as of 19:29, 28 November 2022

Add crontab job

sudo crontab -e

Crontab-step1.png

Choose "1" then press Enter

Add the command line you want to execute at the end of the file that reads like this:

@reboot python /home/pi/x-c1/fan.py


PS:

1. @reboot python /home/pi/x-c1/fan.py is a sample command, You MUST to modify it according to your needs.

2. Please make sure that the file path and file name are correct


Crontab-step2.png

Save and exit (CTRK + O and ENTER to save it). In nano editor, you do that by hitting CTRL + X, answering Y and hitting Enter when prompted.

Please run 'sudo reboot' to reboot device to enable crontab job.

Remove crontab job

sudo crontab -e

then remove the command line by yourself.


Add your comment
Geekworm Wiki welcomes all comments. If you do not want to be anonymous, register or log in. It is free.