Screen and dtach sessions show as main in process manager - Printable Version +- Forum (http://forum.xbian.org) +-- Forum: Software (/forum-6.html) +--- Forum: Testing & Experimental (/forum-21.html) +--- Thread: Screen and dtach sessions show as main in process manager (/thread-2336.html) |
Screen and dtach sessions show as main in process manager - koper89 - 9th Jun, 2014 06:56 AM Hi, Every time when I try to start my daemon start-stop-daemon --chuid $USER --start --name $NAME --nicelevel $NICE --background --pidfile $PID_FILE --make-pidfile --exec /usr/bin/dtach -- -n $TMP /usr/local/bin/rtorrent -n -o import=$CONFIG_FILE My pid file is showing process that don't exist and this process is showed in top as main. What can be a cause of this? I'm trying to make package for xbian but can't make proper stop script for this, and can't kill the process Here's my current init.d file: https://github.com/koper89/xbian-rtorrent/blob/master/content/etc/init.d/rtorrent if you want to test my rtorrent package: https://github.com/koper89/xbian-rtorrent RE: Screen and dtach sessions show as main in process manager - CurlyMo - 9th Jun, 2014 07:10 AM Don't create init.d scripts but rather use upstart ones. Check the /etc/init/ folder for examples. RE: Screen and dtach sessions show as main in process manager - koper89 - 9th Jun, 2014 07:15 AM Ok, I'll check those, and maybe you have any suggestions about using screen dtach t-mux? I wanted to make it as lightweight as I could that's why I choose dtach but maybe you'll have some suggestions and prefer screen t-mux? But i suppouse upstart will not solve "main" problem RE: Screen and dtach sessions show as main in process manager - koper89 - 9th Jun, 2014 07:57 PM Sorry to double post but I suppouse I need more explanation here: 1. I tried on upstart and init.d script 2. Every time I start my dtach or screen session it start as f.e. rtorrent and PID 12100 and after few seconds it changes to main and PID 12101 and I can't stop my process because it's no longer recognized by my script 3. I tried on screen and dtach What can be a cause of this RE: Screen and dtach sessions show as main in process manager - belese - 10th Jun, 2014 05:25 AM it's just a idea, as i don't know so much about upstart, but look at this http://upstart.ubuntu.com/cookbook/#expect RE: Screen and dtach sessions show as main in process manager - koper89 - 10th Jun, 2014 07:23 AM But it's not a problem in upstart, it's general problem in using screen or dtach in xbian since RC2 i suppouse, I have always change PID and name of the process to main.. RE: Screen and dtach sessions show as main in process manager - CurlyMo - 10th Jun, 2014 07:25 AM Why are you using both programs in the first place? Just start rtorrent directly in your upstart script. Simple example from pilight: Code: #!upstart RE: Screen and dtach sessions show as main in process manager - koper89 - 10th Jun, 2014 08:05 AM I said I checked it on both of them not using both at a time. Rtorrent doesn't have a daemon so i suppouse screen or dtach is a must, but maybe I don't understand how upstart works.... And I found what was the cause of my problem it was not screen/upstart/init.d it's propably a bug in rtorrent 0.9.4 when i downgraded to 0.9.3 it's solved and it shows properly rtorrent not main I'll make 3 packages for xbian with rtorrent 0.9.2 (because some trackers don't allow 0.9.3) rtorrent 0.9.3 and dev with 0.9.4 (it's marked as stable but I found that it have a lot of memory leaks which is really visible on raspberry Pi) And should I compile nginx and other dependancies and include them in package, or marking them as dependancies will do the work, as I currently do? Btw. I have also a question about sickbeard-tpb package, (maybe i shouldn't post it here) But why should I add current files of f.e. sickbeard in xbian package, and not use git clone in post install to always get newest version ? Best wishes RE: Screen and dtach sessions show as main in process manager - CurlyMo - 10th Jun, 2014 05:47 PM If you'd actually tried my suggestion, you would have noticed that it was the right way to go It doesn't matter to upstart if something daemonizes or not, as long as you configure your upstart script correctly. Proof of concept Code: cat <<\EOF > /root/test.sh Just copy and paste everything between the code tags at once in your terminal. Then try: Code: service test start However, if you do this in your upstart script Code: exec /root/test.sh & Code: expect fork RE: Screen and dtach sessions show as main in process manager - koper89 - 10th Jun, 2014 06:36 PM I think you're not right, I tested your script (and without dtach or screen it's not working). Don't know why exactly but never find rtorrent running without screen/dtach/tmux. |