Apart from video games one of the great advantages of using computers is that they don't seem to mind doing boring and repetitive tasks that we would rather not do. कंप्यूटर का उपयोग कर के महान लाभ का एक वीडियो गेम के अलावा है कि वे उबाऊ और दोहराव कार्य है कि हम न नहीं होता कर मन नहीं लग रहे हो. For monotonous tasks such as running daily backups we are better off scheduling them to run at a certain time every day, and do more interesting stuff with our time. ऐसी दैनिक बैकअप हम बेहतर कर रहे हैं उन्हें अनुसूचन के लिए हर रोज एक निश्चित समय पर चलने के रूप में चलाने के नीरस कार्य के लिए, और क्या हमारे समय के साथ और अधिक दिलचस्प चीज है. Linux and UNIX usually come with the utility “crontab” by default. Linux और UNIX आमतौर उपयोगिता "crontab के साथ डिफ़ॉल्ट रूप से" आ जाओ. This very useful command allows you to schedule tasks to run at a specified time and repeat as configured. यह बहुत उपयोगी कमांड आप काम अनुसूची करने के लिए एक निर्दिष्ट समय और कॉन्फ़िगर के रूप में दोहराने में चला सकते हैं. A task scheduled using “crontab” is called a “cron job”. एक काम का इस्तेमाल "अनुसूचित crontab" एक "क्रॉन जॉब कहा जाता है."
The crontab command allows you to instruct your server to execute a script at a specified minute of the specified day of the particular month. Crontab कमान आप अपने सर्वर निर्देश करने के लिए विशेष रूप से महीने के निर्दिष्ट दिन के एक निर्धारित समय में एक पटकथा को अंजाम देता है. To see what cron jobs are setup to run on your machine, run the following command: यह देखने के लिए क्या cron रोजगार स्थापना के लिए अपने मशीन को चलाने के लिए, निम्न कमांड चलाने के हैं:
# crontab -l # Crontab-l
If your machine has some cron jobs configured it will display something like the following: यदि आपकी मशीन कुछ cron नौकरी है यह निम्नलिखित की तरह कुछ प्रदर्शित करेगा कॉन्फ़िगर:
0 6 * * * /opt/scripts/backup_script.sh 0 6 * * * / opt / लिपियों / backup_script.sh
The crontab configuration above shows a cron job that executes the shell script “backup_script” everyday at 6 AM. इसके बाद के संस्करण crontab विन्यास एक क्रॉन जॉब कि 6 में खोल स्क्रिप्ट "backup_script" हर रोज़ कार्यान्वित से पता चलता है. The * means to run at every instance of the value in the field. * के क्षेत्र में मूल्य का हर उदाहरण में चलने का अर्थ है. So an asterisk in the day, month, and day of week fields in the above example means that the script should run every day of the month, every month of the year, and every day of the week. दिन का मतलब है, में एक asterisk ऊपर के उदाहरण में महीने, सप्ताह के खेतों के और दिन तो है कि स्क्रिप्ट महीने के हर दिन भागना चाहिए, इस साल के हर महीने, और सप्ताह के प्रत्येक दिन है. The first and second fields tell crontab to execute the script at zero minutes and six hours, which is 6 AM. पहले और दूसरे क्षेत्रों crontab कहना शून्य मिनट और छह घंटे, जो 6 है पर स्क्रिप्ट निष्पादित. So, this cron job configuration would read something like this, “Run the script /opt/scripts/backup_script.sh at zero minutes, 6 AM, every day, every month, and every day of the week.” Below is the “anatomy” of a crontab configuration explained. तो, इस क्रॉन जॉब विन्यास कुछ इस तरह पढ़ते हैं, "भागो स्क्रिप्ट / शून्य मिनट, 6 हूँ, हर दिन, हर महीने, सप्ताह की और हर दिन / लिपियों / backup_script.sh चुनते हैं. होगा" नीचे शरीर रचना विज्ञान 'है एक crontab विन्यास के 'समझाया.
0 6 * * * /opt/scripts/backup_script.sh 0 6 * * * / opt / लिपियों / backup_script.sh
| | | | | | | | | |
| | | | |________________ day of week (Sunday=0) | | | सप्ताह | दिन |________________ (= 0 इतवार)
| | | |__________________ month of year | | | |__________________ साल के महीने
| | |____________________ day of month | | महीने के दिन |____________________
| |______________________ hour of day | |______________________ दिन के घंटे
|________________________ minute of hour |________________________ घंटे की मिनट
To schedule new cron jobs or to edit old ones execute the following command: नए cron रोजगार कार्यक्रम या पुराने संपादित करें निम्न कमांड निष्पादित:
# crontab -e # Crontab-ई
This will bring up an editor with which you can add, edit, or delete “cron jobs”. इसमें एक संपादक है जो आप के साथ जोड़ने के लिए, संपादित कर सकते हैं, या "cron नौकरियों हटा ले 'होगा. To schedule a job to run at 3:45 PM every Monday add entry like this: एक नौकरी कार्यक्रम को 3:45 पर चलाने के हर सोमवार की तरह इस प्रविष्टि जोड़ें:
45 15 * * 1 /opt/scripts/script.sh 45 * 15 * 1 / opt / लिपियों / script.sh
You can also use a comma to add multiple entries into a field. तुम भी एक अल्पविराम का प्रयोग कर एक क्षेत्र में कई प्रविष्टियाँ जोड़ सकते हैं. This is useful if you want to run a script thrice a day, with an eight hour interval. यह तब उपयोगी है यदि आप एक दिन में तीन बार एक स्क्रिप्ट को चलाना चाहता हूँ, है एक आठ घंटे के अंतराल के साथ. Make sure you do not leave space between entries in a single field, though. सुनिश्चित करें कि आपने स्थान प्रविष्टियों के बीच एक भी क्षेत्र में जाना है, फिर भी. Your “cron job” entry would look like this: अपने "क्रॉन जॉब प्रवेश" इस तरह दिखेगा:
0 1,9,17 * 2,11 * /opt/scripts/db_backup_script.sh 0 * 2,11 1,9,17 * opt / / लिपियों / db_backup_script.sh
In the above example the script “db_backup_script.sh” runs at 1 AM, 9 AM, and 5 PM every day in the months of February and November. में ऊपर के उदाहरण लिपि db_backup_script.sh "" फरवरी और नवंबर के महीने में 1, 9, और 5 हर दिन पर चलाता है. There are a lot of cool things that you can do with cron jobs. वहाँ अच्छी चीजें हैं जो आप cron रोजगार के साथ कर सकते हैं एक बहुत कुछ कर रहे हैं. The same works for day, month, and day of week. दिन के लिए ही काम करता है और महीने में सप्ताह के दिन. Once you get the hang of this try out the following. एक बार जब आप इस बाहर निम्नलिखित की कोशिश की लटका मिलता है. Crontab doesn't only understand numbers, it can also operate on some basic English words: Crontab ही संख्या समझ में नहीं आता है, यह भी कुछ बुनियादी अंग्रेजी शब्दों पर काम कर सकते हैं:
string explanation स्ट्रिंग का विवरण
—— ———– - ----
@reboot Run once, the next time the system reboots @ रिबूट एक बार भागो, अगली बार सिस्टम reboots
@yearly Run once a year, at the beginning of the year @ वार्षिक भागो वर्ष में एक बार, इस साल के शुरू में
@annually Same as @yearly, run once annually वार्षिक @ @ के रूप में सालाना भी, एक बार वार्षिक चलाने
@monthly Run once a month, at the beginning of the month @ मासिक भागो महीने में एक बार, महीने की शुरुआत में
@weekly Run once a week, at the beginning of the week @ साप्ताहिक भागो सप्ताह में एक बार, इस सप्ताह की शुरुआत में
@daily Run once a day, at midnight @ दैनिक भागो एक दिन में एक बार, आधी रात को
@midnight Same as @daily, run at midnight दैनिक @ @ आधी रात के रूप में भी, आधी रात को चलाने
@hourly Run once an hour, at the beginning of the hour @ प्रति घंटा भागो एक बार एक घंटा, घंटे की शुरुआत में
So, for example, if you want to run a script at midnight every night, this is what your crontab configuration would look like: तो, उदाहरण के लिए, यदि आप आधी रात हर रात में एक स्क्रिप्ट को चलाना चाहता हूँ, यह है कि आपके crontab विन्यास की तरह दिखेगा:
@midnight /opt/scripts/script.sh आधी रात @ / opt / लिपियों / script.sh
Using “@midnight” rather than “0 0 * * *” will work the same and execute the requested script at midnight every night while being a lot more readable than its numerical counterpart. आधी रात @ प्रयोग "" "के बजाय 0 * * *" एक ही काम करने और आधी रात में हर रात का अनुरोध पटकथा क्रियान्वित करेगा, जबकि बहुत उसकी संख्यात्मक समकक्ष से अधिक पठनीय 0 जा रहा है. You can also make the use of hyphens to declare a range. तुम भी हाइफ़न का प्रयोग कर एक श्रृंखला की घोषणा कर सकते हैं. In the command below “script.sh” will be executed at the beginning of every hour from 1 AM to 6 AM: "Script.sh" नीचे कमान में 1 बजे से हर घंटे की शुरुआत में 6 को मार डाला जाएगा:
0 1-6 * * * /opt/scripts/script.sh 0 1-6 * * * / opt / लिपियों / script.sh
There are many more cool things you can do with cron. वहाँ बहुत अधिक ठंडा बातें तुम cron के साथ क्या कर सकते हैं. Every sysasmin swears by it, it's pretty easy to use once you get the hang on it, and very powerful. हर sysasmin इसे बहाल करना चाहती है, यह सुंदर उपयोग करना आसान है एक बार तुम उस पर रखती हो, और बहुत शक्तिशाली. Use this tool wisely, as scheduling a task wrongly can sometimes do a lot of harm. इस उपकरण का प्रयोग करें बुद्धिमानी, एक कार्य अनुसूचन कभी कभी गलत तरीके से नुकसान का एक बहुत कुछ कर सकते हैं. Reading the “man page” of crontab would be highly recommended. Crontab के "आदमी" पृष्ठ पढ़ना अत्यधिक की सिफारिश की जाएगी.























{ 1 trackback } (1) Trackback
{ 0 comments… (0 टिप्पणियाँ ... add one now एक अभी जोड़ें } )
Leave a Comment एक टिप्पणी छोड़ दो