Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

Screen and dtach sessions show as main in process manager
Thank you for your donation

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Screen and dtach sessions show as main in process manager
9th Jun, 2014, 06:56 AM
Post: #1
koper89 Offline
Registered
Posts: 97
Joined: Jan 2014
Reputation: 8
Screen and dtach sessions show as main in process manager
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 thisBig Grin, 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
Find all posts by this user
Quote this message in a reply
9th Jun, 2014, 07:10 AM
Post: #2
CurlyMo Offline
Registered
Posts: 3,501
Joined: Dec 2012
Reputation: 202
RE: Screen and dtach sessions show as main in process manager
Don't create init.d scripts but rather use upstart ones. Check the /etc/init/ folder for examples.

pilight - modular domotica solution
Visit this user's website Find all posts by this user
Quote this message in a reply
9th Jun, 2014, 07:15 AM
Post: #3
koper89 Offline
Registered
Posts: 97
Joined: Jan 2014
Reputation: 8
RE: Screen and dtach sessions show as main in process manager
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
Find all posts by this user
Quote this message in a reply
9th Jun, 2014, 07:57 PM
Post: #4
koper89 Offline
Registered
Posts: 97
Joined: Jan 2014
Reputation: 8
RE: Screen and dtach sessions show as main in process manager
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
Find all posts by this user
Quote this message in a reply
10th Jun, 2014, 05:25 AM
Post: #5
belese Offline
Moderator
******
Posts: 650
Joined: Jan 2013
Reputation: 38
RE: Screen and dtach sessions show as main in process manager
it's just a idea,
as i don't know so much about upstart,
but look at this
http://upstart.ubuntu.com/cookbook/#expect

Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here
Find all posts by this user
Quote this message in a reply
10th Jun, 2014, 07:23 AM
Post: #6
koper89 Offline
Registered
Posts: 97
Joined: Jan 2014
Reputation: 8
RE: Screen and dtach sessions show as main in process manager
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..
Find all posts by this user
Quote this message in a reply
10th Jun, 2014, 07:25 AM
Post: #7
CurlyMo Offline
Registered
Posts: 3,501
Joined: Dec 2012
Reputation: 202
RE: Screen and dtach sessions show as main in process manager
Why are you using both programs in the first place? Just start rtorrent directly in your upstart script.

Simple example from pilight:
Code:
#!upstart

description "start rtorrent"

start on started mountall and net-device-up
stop on runlevel [016]

exec /usr/local/bin/rtorrent -n -o import=$CONFIG_FILE
Try this one (i adapted from my pilight init).

pilight - modular domotica solution
Visit this user's website Find all posts by this user
Quote this message in a reply
10th Jun, 2014, 08:05 AM
Post: #8
koper89 Offline
Registered
Posts: 97
Joined: Jan 2014
Reputation: 8
RE: Screen and dtach sessions show as main in process manager
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 mainSmile 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 hereTongue) 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
Find all posts by this user
Quote this message in a reply
10th Jun, 2014, 05:47 PM
Post: #9
CurlyMo Offline
Registered
Posts: 3,501
Joined: Dec 2012
Reputation: 202
RE: Screen and dtach sessions show as main in process manager
If you'd actually tried my suggestion, you would have noticed that it was the right way to go Confused 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
#!/bin/bash

while [ 1 ]; do
        sleep 1;
done;
EOF
chmod +x test.sh
cat <<\EOF > /etc/init/test.conf
#!upstart

description "start test"

start on started mountall and net-device-up
stop on runlevel [016]

exec /root/test.sh
EOF
initctl reload-configuration

Just copy and paste everything between the code tags at once in your terminal. Then try:
Code:
service test start
service test stop

However, if you do this in your upstart script
Code:
exec /root/test.sh &
You also need to add:
Code:
expect fork

pilight - modular domotica solution
Visit this user's website Find all posts by this user
Quote this message in a reply
10th Jun, 2014, 06:36 PM
Post: #10
koper89 Offline
Registered
Posts: 97
Joined: Jan 2014
Reputation: 8
RE: Screen and dtach sessions show as main in process manager
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.
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 9th May, 2025, 10:02 PM Powered By MyBB, © 2002-2025 MyBB Group.