2012-09-17 7 views
6

यह एक दोहराया प्रश्न प्रतीत होता है लेकिन ऐसा नहीं है। मुझे उस पर कुछ लेख मिले जहां start-stop-daemon एक पीआईडी ​​फ़ाइल नहीं बना है। लेकिन मेरे मामले में, मैंने पहले ही पीआईडी ​​फाइल बनाई है। मैं अपने सर्वर पर इस आदेश पर अमल Nginx शुरू करने के लिए:स्टार्ट-स्टॉप-डिमन nginx.pid फ़ाइल पर नहीं लिखता है भले ही फ़ाइल मौजूद है

/mnt/nginx/logs/nginx.pid 
start-stop-daemon --start --quiet --pidfile /mnt/nginx/logs/nginx.pid --exec /usr/local/sbin/nginx 

पीआईडी ​​फ़ाइल पहले से ही मौजूद है, लेकिन अभी भी start-stop-daemon फ़ाइल में नहीं लिखा है। मैंने --make-pidfile विकल्प का उपयोग करने का भी प्रयास किया लेकिन फिर start-stop-daemon फ़ाइल में गलत पिड लिखता है।

उत्तर

7

--make-pidfile विकल्प आवश्यक है। start-stop-daemon कारण "गलत पिड" लिखता है nginx कांटेदार। यह start-stop-daemon आदमी पेज में उल्लेख किया गया है:

-m, --make-pidfile 
      Used when starting a program that does not create its own pid 
      file. This option will make start-stop-daemon create the file 
      referenced with --pidfile and place the pid into it just before 
      executing the process. Note, the file will not be removed when 
      stopping the program. NOTE: This feature may not work in all 
      cases. Most notably when the program being executed forks from 
      its main process. Because of this, it is usually only useful 
      when combined with the --background option. 

(forking फिर से भाग देखें।)

आप इस तरह के nginx हो रही अपनी ही पीआईडी ​​फ़ाइल बनाने के लिए के रूप में, एक अलग समाधान का उपयोग करने की आवश्यकता होगी।

+0

अपनी खुद की फाइल बनाने के लिए 'nginx' प्राप्त करना: यह वर्णन है: http://wiki.nginx.org/CoreModule#pid। असल में आपको केवल अपनी nginx.conf फ़ाइल में पिड निर्देश जोड़ना होगा। – Such

संबंधित मुद्दे