Linux/Unix 系統有個 crontab 程式是用來讓系統各使用者自行設定在需要的時間
   ,做需要的事。例如使用者可以設定每星期三的早上8點會自動ftp 到某地去抓檔案,

要有定時裝置,記憶體內要常註 /usr/sbin/crond 程式
 一般 Linux 在開機時會自動載入,如果發現無 crond 在跑,
可以到 /etc/rc.d/ 目錄下看看是否有將執行crond 程式的指令加入開機自動執行檔裡面。

使用者可以用 crontab -e 指令來編寫需要做的工作或者將要執行的工作
或寫在一個 file 裡,再執行 crontab filename  就可以了
所有使用者的 crontab 檔都會存檔 /usr/spool/cron/crontab/ 下,檔名就是該帳號的名字。
crontab 的格式如下:

分 時 日 月 星期 要執行的指令

30 12   *   *   *       /usr/bin/rm xxx.txt

在 12:00 時將 xxx.txt 這個檔案殺掉
* 號表示每日每月每星期都執行
另外寫 crontab 時須注意必須使用 絕對路徑如 rm 執行檔 必須寫成 /usr/bin/rm


           # at 6:10 a.m. every day
           10 6 * * * date

           # every two hours at the top of the hour
           0 */2 * * * date

           # every two hours from 11p.m. to 7a.m., and at 8a.m.
           0 23-7/2,8 * * * date

           # at 11:00 a.m. on the 4th and on every mon, tue, wed
           0 11 4 * mon-wed date

           # 4:00 a.m. on january 1st
           0 4 1 jan * date



# interval: 3min
0-59/3 * * * * date
/usr/lbin/modprpw -k useraccount

 modprpw(1M)                                                     modprpw(1M)

 NAME    [Toc]    [Back]
      modprpw - modify protected password database

 SYNOPSIS    [Toc]    [Back]
      modprpw [-E|-V] [-l|-n [domain]]

      modprpw [-x] [-l|-n [domain]] username

      modprpw [-A|-e|-v|-k] [-m field=value,... ] [-l|-n [domain]] username

 DESCRIPTION    [Toc]    [Back]
      modprpw updates the user's protected password database settings.  This
      command is available only to the superuser in a trusted system.

      Usage other than via SAM, and/or modifications out of sync with
      /etc/passwd or NIS+ tables, may result in serious database corruption
      and the inability to access the system.

      All updated values may be verified using getprpw(1M).

      The database contains information for both local and NIS+ users.
      However, some NIS+ information is kept on the master.  Since a user
      may be both local and NIS+, modprpw uses the nsswitch.conf(4) default
      if neither -l nor -n are specified.

    Options    [Toc]    [Back]
      modprpw sets user's parameters as defined by the options specified.
      At least one option is required.  If a field is not specified in the
      option then its value remains unchanged in the database.

      modprpw recognizes the following options...

    -k   To unlock/enable a user's account that has become disabled,
           except when the lock is due to a missing password or * password.

           May be combined with options -l, -m, -n.

/usr/lbin/getprpw useraccount
unlock / enable / reactivate: /usr/lbin/modprpw -k useraccount lock / expire password:  /usr/lbin/modprpw -e useraccount