Difference between revisions of "How to add crontab job"
Jump to navigation
Jump to search
(Created page with "{{GD Template Impl}} sudo crontab -e File:Crontab-step1.png Choose "1" then press Enter Add a line at the end of the file that reads like this: @reboot python /home/p...") |
|||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{GD Template Impl}} | {{GD Template Impl}} | ||
− | + | ==Add crontab job== | |
sudo crontab -e | sudo crontab -e | ||
Line 7: | Line 7: | ||
Choose "1" then press Enter | Choose "1" then press Enter | ||
− | Add | + | Add the command line you want to execute at the end of the file that reads like this: |
− | @reboot | + | '''@reboot python3 /home/pi/x-c1/fan.py''' |
− | Please | + | '''PS:''' |
+ | |||
+ | 1. '''@reboot python /home/pi/x-c1/fan.py''' is a sample command, You '''MUST''' to modify it according to your needs. | ||
+ | |||
+ | 2. <span style="color:red;">Please make sure that the file path and file name are correct</span> | ||
+ | |||
+ | |||
+ | [[File:Crontab-2.png|800px]] | ||
− | |||
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. | 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 review function! --> | <!--Add review function! --> |
Latest revision as of 09:41, 31 May 2023
Add crontab job
sudo crontab -e
Choose "1" then press Enter
Add the command line you want to execute at the end of the file that reads like this:
@reboot python3 /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
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.
Enable comment auto-refresher