Modernine TV
ͼ : ͼ駢 admin     ʶҹ admin      ҷ駢 ѹ : 3 ԧҤ 2560 10:48:02      ١Դҹ 34   34 / 0    ŴҴѡ ŴҴѡ 
: [ ]      Raspberry Pi      Raspberry Pi      Raspberry Pi
ͧ : ҹ crontab Linux Raspberry pi


Crontab ͤӧҹҷ˹ 觨Ъ·дǡҡ㹡÷еͧ觧ҹҧҧѹ Ҩ繷ء ءѹ ء͹ 蹡 Server ͧŷءѻ



ǹСͺͧ Crontab

 * * * * * command to be executed
 - - - - -
 | | | | |
 | | | | ----- Day of week (0 - 7) (Sunday=0 or 7) ءѹ
 | | | ------- Month (1 - 12) ء͹ 1 - 12
 | | --------- Day of month (1 - 31) ءѹ 1 - 31
 | ----------- Hour (0 - 23) ء 0 - 23
 ------------- Minute (0 - 59) ءҷ 0 - 59



On the other hand instead of the first five fields you can use one of the seven special strings that define for you with an easiest way what you want to do. Those strings are the following:
 
 
 @reboot = Run once, at startup. 
 @yearly = Run once a year
 @monthly = Run once a month
 @weekly = Run once a week
 @daily = Run once a day
 @midnight = Pretty much the same as @daily
 @hourly = Run once an hour





 crontab -e


Menu Select an editor ͡ 2
 
 
 pi@raspberrypi:~$ crontab -e
 no crontab for pi - using an empty one
 
 Select an editor.  To change later, run 'select-editor'.
  1. /bin/ed
  2. /bin/nano        <---- easiest
  3. /usr/bin/vim.tiny

 Choose 1-3 [2]: 2


EDIT crontab -e ç
 EDITOR=nano crontab -e







ʴ crontab 10 ÷Ѵش

 crontab -l | tail -10




/path/to/command ӧҹҼҹ 5ҷ ѧ§׹ 㹷ء ѹ
 5 0 * * * /path/to/command

/path/to/script.sh ӧҹ 14.15. ͧѹ 1 㹷ء ͹
 15 14 1 * * /path/to/script.sh

/scripts/phpscript.php ӧҹ 22.00. 㹷ء ѹ ¡ѹ ҷԵ
 0 22 * * 1-5 /path/to/phpscript.php

/scripts/script.py ӧҹ 23.30. ѹظ ѹҷԵ
 30 23 * * 3,7 /path/to/script.py





Ѵ ˹ҷѷ ӡѴ ( Ҫ ) ͡ͺ෤մԨԵ ȭ