LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-07-2014, 07:18 PM   #1
Soapm
Member
 
Registered: Dec 2012
Posts: 182

Rep: Reputation: Disabled
Program doesn't work on boot up


Hello,

I have a program named Transmission that doesn't work correctly on boot up, but I can type "service transmission-daemon restart" and the program works just fine.

What I mean by doesn't work on start up, I can do ps -A and see the pid, it seems to be active and working but I can't see any activities and can't connect to it remotely.

Looking at the start up screen, it seems to be starting too early in the process. I see services like Samba and Apache starting after it starts. How do I move it back in the start up process? Or how can I troubleshoot why it doesn't work until I restart it?

This is a Debian Wheezy video server... Pretty much all stable but I am using the latest (2.84) version of transmission.
 
Old 11-08-2014, 04:47 AM   #2
lucmove
Senior Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian
Posts: 1,422

Rep: Reputation: 109Reputation: 109
What do you mean by 'bootup'? Do you want it to run automatically right after the computer is booted? And how exactly are you doing that? Where did you insert the command to run transmission? Have you tried running that exact command in a console to see if any errors come up?
 
Old 11-08-2014, 06:59 PM   #3
Soapm
Member
 
Registered: Dec 2012
Posts: 182

Original Poster
Rep: Reputation: Disabled
Thanks for responding...

Quote:
Originally Posted by lucmove View Post
What do you mean by 'bootup'? Do you want it to run automatically right after the computer is booted?
Yes...

Quote:
Originally Posted by lucmove View Post
And how exactly are you doing that? Where did you insert the command to run transmission?
According to the instructions, I made the below start up script in /etc/init.d/transmission-daemon then typed "update-rc.d transmission-daemon defaults" to make it run. This particular script is modified for my box except I recently updated my mobo so loaded Debian64 for the first time. Not sure if 64 makes a difference over 32 bit OS but I did end up having to create this link to make libevent work...

Link
Code:
ln -s /usr/local/lib/libevent-2.1.so.4 /usr/lib/libevent-2.1.so.4
Script
Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides:          transmission-daemon
# Required-Start:    networking
# Required-Stop:     networking
# Default-Start:     2 3 5
# Default-Stop:      0 1 6
# Short-Description: Start the transmission BitTorrent daemon client.
### END INIT INFO

# Original Author: Lennart A. JŒtte, based on Rob Howell's script
# Modified by Maarten Van Coile & others (on IRC)

# Do NOT "set -e"

#
# ----- CONFIGURATION -----
#
# For the default location Transmission uses, visit:
# http://trac.transmissionbt.com/wiki/ConfigFiles
# For a guide on how set the preferences, visit:
# http://trac.transmissionbt.com/wiki/EditConfigFiles
# For the available environement variables, visit:
# http://trac.transmissionbt.com/wiki/EnvironmentVariables
#
# The name of the user that should run Transmission.
# It's RECOMENDED to run Transmission in it's own user,
# by default, this is set to 'transmission'.
# For the sake of security you shouldn't set a password
# on this user
USERNAME=transmission

# ----- *ADVANCED* CONFIGURATION -----
# Only change these options if you know what you are doing!
#
# The folder where Transmission stores the config & web files.
# ONLY change this you have it at a non-default location
TRANSMISSION_HOME="/home/transmission/.config/transmission-daemon/"
TRANSMISSION_WEB_HOME="/usr/local/share/transmission/web"
TR_DEBUG_FD="/var/log/transmission.log"

# The arguments passed on to transmission-daemon.
# ONLY change this you need to, otherwise use the
# settings file as per above.

TRANSMISSION_ARGS="--logfile /var/log/transmission.log"

# ----- END OF CONFIGURATION -----
#
# PATH should only include /usr/* if it runs after the mountnfs.sh script.
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DESC="bittorrent client"
NAME=transmission-daemon
DAEMON=$(which $NAME)
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS

#
# Function that starts the daemon/service
#

do_start()
{
    # Export the configuration/web directory, if set
    if [ -n "$TRANSMISSION_HOME" ]; then
          export TRANSMISSION_HOME
    fi
    if [ -n "$TRANSMISSION_WEB_HOME" ]; then
          export TRANSMISSION_WEB_HOME
    fi

    # Return
    #   0 if daemon has been started
    #   1 if daemon was already running
    #   2 if daemon could not be started
    start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \
            --exec $DAEMON --background --test -- -f $TRANSMISSION_ARGS > /dev/null \
            || return 1
    start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --make-pidfile \
            --exec $DAEMON --background -- -f $TRANSMISSION_ARGS \
            || return 2
}

#
# Function that stops the daemon/service
#
do_stop()
{
        # Return
        #   0 if daemon has been stopped
        #   1 if daemon was already stopped
        #   2 if daemon could not be stopped
        #   other if a failure occurred
        start-stop-daemon --stop --quiet --retry=TERM/10/KILL/5 --pidfile $PIDFILE --exec $DAEMON 
        RETVAL="$?"
        [ "$RETVAL" = 2 ] && return 2

        # Wait for children to finish too if this is a daemon that forks
        # and if the daemon is only ever run from this initscript.
        # If the above conditions are not satisfied then add some other code
        # that waits for the process to drop all resources that could be
        # needed by services started subsequently.  A last resort is to
        # sleep for some time.

        start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
        [ "$?" = 2 ] && return 2

        # Many daemons don't delete their pidfiles when they exit.
        rm -f $PIDFILE

        return "$RETVAL"
}

case "$1" in
  start)
        echo "Starting $DESC" "$NAME..."
        do_start
        case "$?" in
                0|1) echo "   Starting $DESC $NAME succeeded" ;;
                *)   echo "   Starting $DESC $NAME failed" ;;
        esac
        ;;
  stop)
        echo "Stopping $DESC $NAME..."
        do_stop
        case "$?" in
                0|1) echo "   Stopping $DESC $NAME succeeded" ;;
                *)   echo "   Stopping $DESC $NAME failed" ;;
        esac
        ;;
  restart|force-reload)
        #
        # If the "reload" option is implemented then remove the
        # 'force-reload' alias
        #
        echo "Restarting $DESC $NAME..."
        do_stop
        case "$?" in
          0|1)
                do_start
                case "$?" in
                    0|1) echo "   Restarting $DESC $NAME succeeded" ;;
                    *)   echo "   Restarting $DESC $NAME failed: couldn't start $NAME" ;;
                esac
                ;;
          *)
                echo "   Restarting $DESC $NAME failed: couldn't stop $NAME" ;;
        esac
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;
esac
Quote:
Originally Posted by lucmove View Post
Have you tried running that exact command in a console to see if any errors come up?
Yes, two things here, after the system boots, I can log in via ssh and type "service transmission-daemon restart" and it works fine from there...

Also, part of the install instructions have you run the below commands which also work just fine...

Code:
su transmission
transmission-daemon -f
The only problem I'm having is that it doesn't run correctly during boot. It runs as in I can see a PID for the service transmission, but I can connect to the service or see any signs that it's doing anything until I restart the application.

Last edited by Soapm; 11-08-2014 at 07:02 PM.
 
Old 11-08-2014, 11:08 PM   #4
Soapm
Member
 
Registered: Dec 2012
Posts: 182

Original Poster
Rep: Reputation: Disabled
I made a new log file so I could see if anything was there and I think I see the problem. It looks like the application is having trouble binding to the ports. The ports it should be using are 51413 and 9091 for RPC.

Could it be starting before networking is started??? How can I tell what sequence each application is starting??? How can I move networking up on the startup list? I doubt if anything else is binding to the port since I can restart it and it works fine.

Code:
[2014-11-08 20:55:31.583 MST] RPC Server Adding address to whitelist: *.*.*.* (rpc-server.c:814)
[2014-11-08 20:55:31.583 MST] RPC Server Serving RPC and Web requests on port 127.0.0.1:9091/transmission/ (rpc-server.c:1021)
[2014-11-08 20:55:31.583 MST] getaddrinfo: address family for nodename not supported (trevent.c:216)
[2014-11-08 20:55:31.583 MST] RPC Server Whitelist enabled (rpc-server.c:1025)
[2014-11-08 20:55:31.583 MST] RPC Server Password required (rpc-server.c:1028)
[2014-11-08 20:55:31.583 MST] Couldn't bind port 51413 on 192.168.0.1xx: Cannot assign requested address (net.c:371)
[2014-11-08 20:55:31.583 MST] Bound socket 13 to port 51413 on :: (net.c:379)
[2014-11-08 20:55:31.583 MST] UDP Couldn't bind IPv4 socket (tr-udp.c:263)
 
Old 11-08-2014, 11:26 PM   #5
Soapm
Member
 
Registered: Dec 2012
Posts: 182

Original Poster
Rep: Reputation: Disabled
I think I got it fixed by changing the start up script from;

Code:
# Required-Start:    networking
to

Code:
# Required-Start:    $remote_fs $syslog $all
Now transmission is listed last the /etc/rc2.d/ directory (S20transmission-daemon).

And from what I'm seeing on google, the first networking entry should actually be;

Code:
# Required-Start:    $networking
But I have no idea if that dollar sign makes a difference or not...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
removing a program doesn't work? Skullsoldier Linux - Newbie 14 11-22-2010 08:46 AM
Program initiated via python's os.system() doesn't work (when in crontab script) itmi Programming 3 03-03-2008 06:36 PM
Lost Linux boot and boot floppy doesn't work marquedios Linux - Newbie 9 05-22-2005 03:21 PM
Can only start program from console, link doesn't work. longblock454 Linux - Newbie 12 02-02-2005 08:18 PM
logout in x doesn't work and nvidia doesn't boot Meriadoc Linux - Newbie 2 06-18-2004 01:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration