SManager - script executing fine manually, but not at boot

Search This thread

AaylaSecura

Member
Aug 6, 2010
24
0
Greetings! I know there have been many topics on how to run scripts at boot time, most suggesting the safe way using Script Manager. But I'm encountering an odd issue:
I installed dropbear via opkg as described here and I wrote a script that would execute as root and start it. The script executes fine when I run it manually (either from SManager or from my terminal emulator using sh) and I am able to connect to my phone via ssh. However, when I set SManager to run the script at boot, the script executes fine, the processes are running (I can see them in the output of ps), the output from the processes (saved to log files) is the same as when I run them manually (and the connection can be established), but there is no TCP port associated with dropbear. I check using netstat - when I run the script manually, I can see the listening port, but not when the script is run automatically. Consequently, I cannot connect to my phone even though dropbear is running and reports it's listening on the port I specified. I tried adding a 2 minute delay in the script before dropbear is started (to allow the device to fully boot up) and I can confirm dropbear is started well after every other process, but the result is the same. I'm not sure if this is a problem with dropbear, SManager or something else.
I tried putting the script in /etc/init.d and making it executable, but it is not being run at all, I don't think scripts there are being read (there is no such entry in /init.rc that checks scripts in /etc/init.d).
I'm running SlimBean 4.2.2 on Samsung Galaxy S with 3.0.71-Semaphore_JB_2.9.18s kernel. Here follows the script:

Code:
#!/system/bin/sh

# dropbear and ssh are installed in /data/local/bin
export PATH=$PATH:/data/local/bin
sleep 1s
dropbear -p 42549 -v &>/sdcard/droplog
sleep 1s
# set up remote port forwarding (reverse ssh) to my PC so I can connect to my phone through its network's firewall
ssh -TfN -o "GlobalKnownHostsFile /data/.ssh/known_hosts" -p 4713 -R 4714:localhost:42549 tcpfwd@<my-PC's public IP address> &>/sdcard/sshlog &