Linux [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Linux [Electronic resources] - نسخه متنی

Janet Valade

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


Scheduling Scripts to Run Automatically


Linux allows you to schedule a command to run at a specified time. You can use this ability to schedule scripts to run automatically. You schedule jobs using the crontab command.

The first time you schedule a job, you create a file with the commands you want to schedule. Each command goes on a separate line. The crontab format requires six items on the line, each separated by a space. The items are, in the order of occurrence:

  • Min :
    Minute to run. Values can be 059.

  • Hour :
    Hour to run. Values can be 023.

  • Day of month :
    Day of the month to run. Values can be 131.

  • Month :
    Month to run. Values can be 112.

  • Day of week :
    Day of week to run. Values can be 06, with 0 being Sunday.

  • Command :
    Command to run.


Each item must be present. If an item is not relevant for your scheduling, enter *. Below are two crontab entries that run a shell script:

59 0 * * * /home/janet/backup
0 2 * * 5 /home/janet/cleanup

The first line runs the script backup at midnight every night. The second line runs cleanup at 2 a.m. every Friday.

Create a file named crontab that contains entries for the jobs you want to run automatically. To schedule your jobs, type:

crontab crontab

This will schedule your jobs. If the command fails, you may need to change to the root account. As root, you can schedule the job for another user, as follows:

crontab -u janet crontab

You can see what is scheduled for you by typing:

crontab -l

You can change your scheduled jobs by typing:

crontab -e


    / 357