Hi,
I have created an init script to start another script at boot time. Works as expected.
(OpenWrt 21.0.2 on NanoPi R2S)
The script started by the init.d script is working as expected, until it reaches an scp command.
So I have stripped down the script just for testing to this one.
#!/bin/sh
echo "starting"
scp /tmp/text.txt r2s.far.xa:/tmp/rtext.txt
echo "finished"
When running the script from OpenWrt CLI everything works as expected. The file is copied without any further question. (keys are exchanged for user root)
But when started by the init.d script nothing happens.
When looking at process list I found this:
$ ps w
...
22988 root 1012 S scp /tmp/text.txt r2s.far.xa /tmp/rtext.txt
22989 root 1040 S /usr/bin/dbclient r2s.far.xa scp -t /tmp/rtext.txt
...
/etc/init.d/myscript
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=95
STOP=01
start_service() {
procd_open_instance
procd_set_param command /bin/sh "/usr/bin/myscript.sh"
procd_close_instance
}
What to do to get scp (and ssh -t afterwards) running?
Henning