كيف أن يبرمج مهام على [لينوإكس] يستعمل ال `في' أمر

ب [سوكريت] [دهندهنيا] على شهر ماي 4, 2009

[لينوإكس]

[سكهدولينغ] أشغال جزء أساسيّة من يدير [لينوإكس] نادلات. نحن أخذنا نظرة في كيف أن يبرمج أشغال على [لينوإكس] آلة يستعمل ال [كرون] أمر [إرلير]. هنا خيار إلى [كرون] - في. الفرق أوّليّة بين الاثنان أنّ عندما يبرمج أنت مهمة يستعمل [كرون] هو نفّذت بشكل متكرّر دون الحاجة ل يدرج. مع في, [أن ث ون هند], ال يبرمج من مهمة فقط لتنفيذ وحيد. يتلقّى [بوث وف ثيس] أوامر إستعمالهم, وأنا اقترحت أنّ أنت تحصل تفهم جيّدة من هم كلا.

[لت'س] نظرت في كيف أن يبرمج مهمة أن ينفّذ فقط مرّة يستعمل ال في أمر. أولى تأكّدت أنّ ال في [دمون] يركض يستعمل أمر مثل هذا:

# [بس] - [إف] | [غرب] [أتد]
جذر 8231 1 0 18:10? 00:00: 00 /usr/sbin/atd

إن أنت لا ترى [أتد] بداية جارية هو مع هذا أمر:

# /etc/init.d/atd بداية

ما إن ال [دمون] يتلقّى يكون بدأت بنجاح أنت يستطيع برمجت في مهمة يستعمل الاثنان خيارات - [ف], للمبرد أن يكون نفّذت, و - [ف], للوقت في أيّ هو سوفت كنت نفّذت. هكذا إن أنت تريد أن ينفّذ ال [شلّ سكريبت] shellscript.sh في 6:30 بعد الظّهر ركض أنت الأمر تالي:

# في - [ف] shellscript.sh - [ف] 18:30

تذكّرت أنّ مع ال في أمرت النص shellscript.sh سينفّذ في 6:30 بعد الظّهر وبعد ذلك سيختفي ال يبرمج. هكذا إن هذا ليس ماذا أنت ب رغب, أنت جيّدة من يستعمل [كرون].

ال في أمر إلى حدّ ما ذكيّة داخل أنّ هو يستطيع أخذت بعض أوامر في إنجليزيّة إن أنت تحبّ. مثلا, أنت يستطيع برمجت أشغال يستعمل الإعراب تالي أيضا:

# في - [ف] shellscript.sh [10بم] غدا

# في - [ف] shellscript.sh 2:50 يوم الثلاثاء

# في - [ف] shellscript.sh 6:00 يوليو-تمّوز 11

# في - [ف] shellscript.sh 2:00 أسبوع تالية

موقعات متّصلة:
  • زدت ك [لينوإكس]/[أونيإكس] إنتاجية: كيف أن يستعمل [كرونتب]
  • لوحة قيادة [ويدجت]: [ملب] جدول
  • كيف أن يتوقّف ماك ك من يفيق عندما هو سوفت كنت نمت
  • كيف أن ينقذ الإنتاج من [لينوإكس] أمر إلى مبرد
  • How to post to Twitter from the Linux command line
  • Get Simple Help tutorials just like this one in your email inbox every day - for free! Just enter your email address below:

    You can always opt out of this email subscription at any time.

    { 2 comments… read them below or add one }

    1 MikeT 05.04.09 at 5:26 am

    If you don’t see atd running start it with this command:

    # /etc/init.d/atd start

    More correctly, if it isn’t running, it probably is not configured to startup when the system is restarted. Which may also keep the above command from working as expected. To correct this, use:

    # chkconfig atd --level 234 on
    # service atd start

    and check again to make sure it is running, if it is, continue with the instructions (which are very good BTW).

    2 MikeT 05.04.09 at 5:32 am

    I have another followup for you on use of the at command.

    I’ve run into situations where I’ve needed a command run every hour BUT I needed the command to run ONLY if the previous run has completed. It might not be hung but it might be very very busy. I don’t mind skipping an hour’s execution if the process is still busy.

    When this situation arises, I don’t use cron, I use ‘at’ and the last thing I put in my script is the at command itself to resubmit the job for execution.

    Now, even if the job takes three hours, at the top of the following hour, the at command will launch the job as expected without cron jobs bumping into each other.

    Yes, there’s ways to put the logic into a script for cron to deal with it but that can also be difficult to maintain and not as obvious (to some) as this approach.

    Leave a Comment

    You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>