Crontab 排程設定指定執行結果通知人員

版主: stnet253

回覆文章
tony
文章: 585
註冊時間: 2012-02-26, 07:04
聯繫:

Crontab 排程設定指定執行結果通知人員

未閱讀文章 tony »

指定 root 帳號排程的設定檔路徑,也可不需指定各發行版預設路徑會有所不同。「man crontab」可查知一二。
# crontab /var/cron/crontab/root

編輯設定檔 指定「MAILTO」參數值,將此參數寫在排程命令之前。
# crontab -e

Ubuntu 12.04 執行 crontab -e 的畫面
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command

MAILTO=[email protected]
回覆文章

誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 1 位訪客