What's new

Help with services-start

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Alessio

Occasional Visitor
Hello,
I'm using the latest merlin build 378.53 and I've noticed that after a reboot rtorrent won't auto start, I have to initiate a shell session and type those commands:
Code:
/opt/etc/init.d/S85rtorrent start
/opt/etc/init.d/S80lighttpd start

I've also tried to insert those commands in /jffs/scripts/services-start :
Code:
#!/bin/sh

sleep 10
/opt/etc/init.d/rc.unslung start
/opt/etc/init.d/S80lighttpd start
/opt/etc/init.d/S85rtorrent start

But If I reboot rutorrent won't auto start.

Thanks for any help
 
I think you control the Entware services you wish to auto-start, by specifying the "ENABLED=yes" switch inside each services script.

/jffs/scripts/services-start
Code:
#!/bin/sh

# start all Entware services
sleep 60 && /opt/etc/init.d/rc.unslung start &

/jffs/scripts/services-stop
Code:
#!/bin/sh

# stop all Entware services
/opt/etc/init.d/rc.unslung stop


My DNSCrypt service will auto-start because "ENABLED=yes".

/opt/etc/init.d/S09dnscrypt-proxy
Code:
#!/bin/sh

ENABLED=yes
PROCS=dnscrypt-proxy
ARGS="--local-address=127.0.0.1:65053 --daemonize -R opendns"
PREARGS=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/opt/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 
Last edited:
Hello, thanks for your reply.

I think the scripts in /opt/etc/init.d/ ar ok:

/opt/etc/init.d/S80lighttpd
Code:
#!/bin/sh

ENABLED=yes
PROCS=lighttpd
ARGS="-f /opt/etc/lighttpd/lighttpd.conf"
PREARGS=""
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/opt/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

. /opt/etc/init.d/rc.func
/opt/etc/init.d/S85rtorrent
Code:
#!/bin/sh

ENABLED=yes
PROCS=rtorrent
ARGS="-D -n -o import=/opt/etc/rtorrent/rtorrent.conf"
PREARGS="screen -dmS rtorrent"
DESC=$PROCS
PATH=/opt/sbin:/opt/bin:/opt/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

if [ -z "`pidof $PROCS`" ]; then
    rm -f /opt/var/rpc.socket
fi
. /opt/etc/init.d/rc.func

Amd here is my /jffs/scripts/services-stop :
Code:
#!/bin/sh

/opt/etc/init.d/rc.unslung stop
/opt/etc/init.d/S85rtorrent stop
/opt/etc/init.d/S80lighttpd stop
 
P.S. I didn't mention, but I'm aware that 378.50 introduced a new setting to enable script execution, and I've enabled it on the Administration-System page, I've also executed the command :
Code:
chmod a+rx /jffs/scripts/*
 
All you have to do is to add to /jffs/scripts/post-mount

sleep 30
/opt/etc/init.d/rc.unslung restart

Also, if you have rc.unslung in /opt/etc/init.d don't need any other commands to start services like you added in services-start
 
All you have to do is to add to /jffs/scripts/post-mount

sleep 30
/opt/etc/init.d/rc.unslung restart

Also, if you have rc.unslung in /opt/etc/init.d don't need any other commands to start services like you added in services-start like /opt/etc/init.d/S80lighttpd start
 
P.S. to stop theese services shuold I use /jffs/scripts/services-stop ?
Code:
#!/bin/sh

# stop all Entware services
/opt/etc/init.d/rc.unslung stop
 
Related question- the first time I set up my router I noticed these lines in my services-start:
RC='/opt/etc/init.d/rc.unslung'

i=30
until [ -x "$RC" ] ; do
i=$(($i-1))
if [ "$i" -lt 1 ] ; then
logger "Could not start Entware"
exit
fi
sleep 1
done
$RC start
/opt/etc/init.d/S09dnscrypt-proxy start

However, the 2nd time (I had to factory reset), I only noticed the lines

RC='/opt/etc/init.d/rc.unslung'
i=30
until [ -x "$RC" ] ; do
i=$(($i-1))
if [ "$i" -lt 1 ] ; then
logger "Could not start Entware"
exit
fi
sleep 1
done
/opt/etc/init.d/S09dnscrypt-proxy start

The $RC start was missing.
What does this command do, and do I need it?

Thanks.
 
I'm in the middle of a little project. Just trying to learn a little more about Linux, really. What I'm doing is I've disabled MiniDLNA that's built into the router and I'm now using the one from Entware. I know the package that comes with ASUS' firmware is kept up-to-date so it's not out of any sort of troubles that I want to do this. It's just to learn a little. So I'll spare you the entirety of the story and just let you know where I'm at.

It's working. The problem I'm having is with it starting on boot. And so I did what TeHashX outlined here and that worked but I feel like there should be a better way. Reason being is because I also have Transmission working successfully and have for a while now. That starts on boot up. I figured I'd go back to the install guide and see if there was a step that I did in order to get it to start at boot but it doesn't look like it. So what I have is Transmission starting on boot, but then using the

Code:
sleep 30
/opt/etc/init.d/rc.unslung restart

stops Transmission, restarts it, then starts MiniDLNA. And I know that doesn't really matter in the grand scheme of things, but my curiosity lies in the fact that the install process for both was really similar but one ended up getting started on boot up and the other didn't. I've been through all the scripts I can think of that might specifically have a line for starting Transmission but I don't see that anywhere.
 
I'm in the middle of a little project. Just trying to learn a little more about Linux, really.
If that's your objective I'd suggest that you don't look too much at the router code, it's not really representative of any Linux "distribution", it's just a Linux kernel with some bespoke code running on it. A better "learning experience" would be something like Centos or Debian.
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top