0

Ultimately I'm trying to get a program to run at start up and work correctly.

I have been successful in getting it to show up in running processes after a reboot, but it doesn't seem like it is working correctly.

I started to troubleshoot the problem and I came across some interesting discoveries.

I am running openmediavault 1.0.20 which is based on Debian Wheezy and logged in as root with ssh.

Path to uTorrent install: /opt/utorrent

If I enter

cd /opt/utorrent          
./utserver

utserver runs and I'm able to to access the webui by server'sip:8080/gui

However when I run

cd /
/opt/utorrent/utserver

utserver runs but the web ui is not accessible. I don't understand why one way works and yet the other doesn't.

Once I can get the webui to work after running /opt/utorrent/utserver the modifications I made to rc.local should work correclty

Current contents of rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

#Auto run uTorrent at start up
#su ut -c '/opt/utorrent/utserver &'
sudo /opt/utorrent/utserver &


exit 0
1
  • 1
    It's possible that utserver looks for a configuration file in the directory it's started from. Something like "use from current directory, or else from user's home directory, or else hard-coded defaults" sounds reasonable, and maybe the defaults don't have the web interface enabled. The docs should be able to tell you. Commented Nov 23, 2014 at 15:11

1 Answer 1

1
  1. Don't use sudo in init scripts. They're run as root to start with.

  2. If you were to use sudo in /etc/rc.local (which as per #1 there is no point in doing), you need to provide a $PATH or the path to the executable because there is no $PATH set when this is run at boot by init. So, e.g., if you wanted to run ls, first find out where it is:

    whereis ls ls: /usr/bin/ls /usr/share/man/man1p/ls.1p.gz /usr/share/man/man1/ls.1.gz

    So, you either need:

    export PATH=/usr/bin/  # At the top
    - OR -
    /usr/bin/ls   # Where you want to run it.
    

Beware that processes started from an init script must background themselves, your

/opt/utorrent/utserver &

Should be fine.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.