Skip to content Skip सामग्री के लिए


Running process in the background with Nohup Nohup के साथ पृष्ठभूमि में प्रक्रिया चल रहा है

लिनक्स

I work on remote servers a lot. मैं दूरस्थ सर्वर पर एक बहुत काम है. I use SSH to connect to my servers. मैं उपयोग ssh अपने सर्वर से कनेक्ट. Quite often I run a process that I need to let run even after I close my SSH connection. अक्सर मैं एक प्रक्रिया है कि मैं भाग जाने की आवश्यकता के बाद भी मैं अपने ssh संबंधन पास चला रहे हैं. This could be a shell script that parses through my log files or very large mysql database restoration. यह एक खोल स्क्रिप्ट हो सकता है कि मेरी लॉग फाइल या बहुत बड़े mysql डेटाबेस बहाली के माध्यम से parses. That's when I turn to a Linux command line utility called “nohup”. कि जब मैं एक Linux कमांड लाइन उपयोगिता "nohup" बुलाया के लिए बारी है. “Nohup” is short for “no hangup”, which translates to “ignore the hang up signal”. "Nohup 'के लिए कम" है कोई hangup ", जो" रखती संकेत की अनदेखी तब्दील हो ". The “hang up” signal is what happens when you log out. "ऊपर संकेत" रखता है क्या होता है जब तुम बाहर लॉग इन करें. What “nohup” does is that it allows you to log into your server, launch a process and log out. क्या "nohup" करता है कि आप अपने सर्वर में प्रवेश करने के लिए एक प्रक्रिया शुरू करने और प्रवेश की अनुमति देता है. The process keeps running even after you have logged out. प्रक्रिया चालू रहता है के बाद भी तुम बाहर लॉग इन किया है. When you log in again you can access that process again, provided its still running. जब तुम फिर आप उस प्रक्रिया को फिर से उपयोग में लॉग इन कर सकते हैं, बशर्ते उसका अभी भी चल.

The basic syntax of “nohup” is: "Nohup 'की मूल वाक्य है:

# nohup [command] & # Nohup [आदेश] और

Replace “[command]” with the name of your shell script, or a command. बदलें "[आदेश] अपने खोल स्क्रिप्ट, या एक कमांड के नाम के साथ". The “&” at the end makes the command or script run as a background process. "&" अंत में कमांड या स्क्रिप्ट एक पृष्ठभूमि प्रक्रिया के रूप में चला जाता है. Here's an example of how you would use “nohup” to take a backup of a large mysql database on your remote server. यहाँ आप "nohup" का उपयोग कैसे अपने दूरदराज के सर्वर पर एक बड़ी mysql डेटाबेस के एक बैकअप ले जाएगा एक उदाहरण है. First, I log in to my remote server using SSH: सबसे पहले, मैं अपने दूरस्थ सर्वर में प्रवेश करें ssh का उपयोग:

# ssh calvin@sevenacross.com # Ssh calvin@sevenacross.com

Then I execute the command “mysqldump -ucalvin -phobbes largedatabase > largedatabase.db” in the “nohup” mode by adding a “nohup” before and “&” after the command: तब मैं चलानेकेलिएकमांड "mysqldump-ucalvin-phobbes largedatabase> largedatabase.db nohup" में "मोड" एक nohup "जोड़ने" और पहले "&" कमांड के बाद से:

# nohup mysqldump -ucalvin -phobbes largedatabase > largedatabase.db & # Nohup mysqldump-ucalvin-phobbes largedatabase> और largedatabase.db
[1] 3999 1 [3999]
# nohup: appending output to `nohup.out' # Nohup: उत्पादन appending nohup.out 'को'

There are two lines of output that you get. वहाँ उत्पादन की दो लाइनें कि तुम मिल रहे हैं. The “3999″ in the first line is the process ID of the process that I just spawned, while the “nohup: appending output to `nohup.out'” means that the out put that would usually come to the terminal is being forwarded into a file called “nohup.out” in the directory from which you launched the command. "पहली पंक्ति में" 3,999 प्रक्रिया है इस प्रक्रिया है कि मैं अभी पैदा की पहचान की है, जबकि "nohup: उत्पादन appending को` nohup.out 'का अर्थ है "कि बाहर रखा है कि आम तौर पर टर्मिनल आने वाला है में भेजा जा रहा होगा एक फ़ाइल नाम "nohup.out" निर्देशिका जहाँ से आप कमांड शुरू में. You can check if the process is still running by searching through all the running processes using the process ID: यदि आप जांच प्रक्रिया अभी भी खोज के माध्यम से सभी चलाने की प्रक्रिया का उपयोग कर प्रक्रियाओं आईडी से चल रहा है सकते हैं:

# ps -ef | grep 3999 # पी एस-एफई | 3,999 grep
calvin 3999 29848 0 18:42 ? केल्विन 3999 29848 18:42 0? 00:00:00 /usr/bin/mysqldump 00:00:00 / usr / bin / mysqldump
calvin 6575 31852 0 18:44 pts/2 00:00:00 grep 3999 केल्विन 6575 31852 0 18:44 अंक / 2 00:00:00 3,999 grep

When the process is done running you will see an output in the command line like this: जब प्रक्रिया चल रहे तुम इस तरह से कमांड लाइन में एक आउटपुट देखेंगे किया जाता है:

[1]+ Done nohup mysqldump -ucalvin -phobbes largedatabase > largedatabase.db [1] + हो गया nohup mysqldump-ucalvin-phobbes largedatabase> largedatabase.db

You can check the file “nohup.out” to check for any errors or other messages that were output while the process was running. आप फाइल की जांच "nohup.out" के लिए किसी भी त्रुटि या अन्य संदेश है कि उत्पादन में थे, जबकि इस प्रक्रिया को चला रहा था के लिए जाँच कर सकते हैं. If the file remains blank that's okay. यदि फ़ाइल रिक्त है कि ठीक है रहता है. It means no messages were output while the process was running. इसका मतलब है कोई संदेश नहीं थे, जबकि उत्पादन की प्रक्रिया चल रही थी.

Posted in पोस्ट में Linux लिनक्स . .

Related Posts: संबंधित पोस्ट:

How to use dstat to monitor your Linux/UNIX server कैसे dstat उपयोग के लिए आपके Linux / यूनिक्स सर्वर की निगरानी
How to get detailed information on each running process in Windows कैसे Windows में एक दौड़ प्रक्रिया के बारे में विस्तृत जानकारी मिलती है
How to use a screensaver as your desktop background in OS X कैसे ओएस एक्स में अपने डेस्कटॉप पृष्ठभूमि के रूप में एक स्क्रीनसेवर का उपयोग
How to reset a lost MySQL root password कैसे एक खो MySQL रूट पासवर्ड रीसेट के लिए
How to blurminal your OS X Terminal कैसे अपने ओएस एक्स के लिए टर्मिनल blurminal

3 Responses 3 जवाब

Stay in touch with the conversation, subscribe to the बातचीत के साथ संपर्क में रहो, की सदस्यता लें RSS feed for comments on this post आरएसएस के इस पोस्ट पर टिप्पणियों के लिए फ़ीड . .

  1. Bobby Cox says बॉबी कॉक्स कहते हैं,

    Hello – Nohup is useful, but if you use screen you can detach and reattach to a terminal at will and have commands running in the background as well. नमस्कार - Nohup उपयोगी है, लेकिन यदि आप स्क्रीन का उपयोग आप में एक अलग और टर्मिनल को पुनः अनुलग्न कर सकते हैं पृष्ठभूमि में चलाने के रूप में अच्छी तरह से आदेश दिया है और होगा.

    http://www.gnu.org/software/screen/ http://www.gnu.org/software/screen/

    --
    Bobby बॉबी

  2. it guy यह आदमी says कहता है

    I recently used the 'nohup' command as sugested for an instance of tshark I wanted to run for a long time. मैं हाल ही के रूप में '' nohup कमान उपयोग tshark का एक उदाहरण मैं एक लंबे समय तक चलने के लिए sugested चाहता था.

    Nohup worked great. Nohup महान काम किया. Thanks guys. धन्यवाद दोस्तों.

  3. Parikshit says Parikshit कहते हैं,

    I am running a PERL script in background using nohup command. मैं पृष्ठभूमि में एक perl स्क्रिप्ट nohup कमांड का प्रयोग चल रहा है. this script prints logs on the screen. इस स्क्रिप्ट स्क्रीन पर लॉग प्रिंट. Though i used & to run it in background it still prints the logs on the console . हालांकि मैं करता था और इसे पृष्ठभूमि में चला यह अभी भी कंसोल पर लॉग प्रिंट. How can it be actually run in background so that it shouldn't print anything on the screen . यह वास्तव में कैसे पृष्ठभूमि में चला जा सकता है ताकि इसे परदे पर कुछ भी छाप नहीं होना चाहिए.



Some HTML is OK कुछ HTML है ठीक है

or, reply to this post via या, इस पोस्ट के माध्यम से जवाब trackback Trackback . .