i would like to run a script (sh /usr/local/run.sh) at boot but after samba loads transmission-daemon service starts
i tried putting the script in /etc/rc.local directly and after using sleep 60 both seem to execute before samba loads transmission-daemon service starts
im using exroot so that is probably adding to boot time, possibly
samba4's init.d script is queued into start position 98. That does not leave many a whole lot of two-digit numbers that are higher, but 99 will do: Write your script as a small init.d script that queues itself with START=99 and it will be executed after samba4's init script:
#!/bin/sh /etc/rc.common
START=99
start() {
# your script here, or just call /usr/local/run.sh
}
Run a loop in rc.local, using netcat, let it check if whatever port your transmission is using is listening, if/when it is, terminate loop, and send notification.
however, adding this loop script in rc.local prevents the rest of the services from loading and keeps running in a loop, needed a manual restart after commenting out the loop script in rc.local
maybe this behavior is because im using exroot
had to install netcat opkg update && opkg install netcat
the loop script
#!/bin/sh
echo "waiting for transmission to launch on 9091..."
while ! nc -zv localhost 9091; do
sleep 1
done
echo "transmission launched"
/usr/local/run.sh
no. im unable to describe what is happening exactly, but if i run the script, it does not allow services like transmission-daemon to start, for some reason
adding an & to the end in rc.local helped (sh /usr/local/loop.sh &) in the sense that transmission-daemon loaded (in comparison to earlier), however the script did not execute as desired and as it does when i run it manually, nothing happened
if you execute a loop, then yes, everything executed after it, will wait until the looping netcat check completes.
via ssh
stop the transmission service
execute the loop.sh, and keep it running in foreground.
in a parallell ssh session start the transmission service again.
nope. clean exit when i run it manually, when i run either loop.sh or run.sh its only when i run loop.sh in background bay adding & that it does not exit