I try a script for my config, I would like to have the most complete config but I need to exit to scp a file from m pc, but after that, I guess I need to run another script to complete the config?
here a part of my script;
#!/bin/sh
# === Update root password =====================
# Update the root password.
#
echo 'Updating root password'
NEWPASSWD=XXXXXXXXXXXX
passwd <<EOF
$NEWPASSWD
$NEWPASSWD
EOF
# === Set up the WAN (eth0) interface ==================
#
# echo 'Configuring WAN link DHCP'
uci set network.wan.metric=1024
uci set network.wan.peerdns=0
uci add_list network.wan.dns=192.168.1.1
uci commit network
ifup wan
echo 'Waiting for link to initialize'
sleep 20
# === Set the Time Zone ========================
# Set the time zone to non-default (other than UTC)
#
TIMEZONE='EST5EDT,M3.2.0,M11.1.0 '
ZONENAME='America/Montreal'
echo 'Setting timezone to' $TIMEZONE
uci set system.@system[0].timezone="$TIMEZONE"
echo 'Setting zone name to' $ZONENAME
uci set system.@system[0].zonename="$ZONENAME"
uci commit system
# dnsmasq && Dnscript
cd /etc/dnscrypt-proxy2
rm dnscrypt-proxy.toml
exit
scp /run/media/perkel/dnscrypt-proxy.toml root@192.168.1.1:/etc/dnscrypt-proxy2/
ssh root@192.168.1.1
uci set dhcp.@dnsmasq[0].noresolv='1'
uci set dhcp.@dnsmasq[0].doh_backup_noresolv='-1'
uci set dhcp.@dnsmasq[0].server='127.0.0.53#53'
uci commit network
etc etc....... This is what I found to try to have my own toml file into router, but after I dont know what to do to continu the script, a second one ?
What are you actually trying to do?
Have a script in the router that runs in the router and does some UCI configuration and also copies a file from somewhere to the router?
Is the script included in your build?
If yes, why are you not including also the .toml file that you need.
You can include pretty much anything as "custom file".
Yes, it is possible to exit the session; and that is exactly what is happening here... Now, why don't you just put the "scp" command before the "exit"?
yep I've put the scp after the exit command, but as the others have said, the exit command, only stop the script, I'm still in my ssh openwrt session after that, to scp I need to exit the openwrt shell session... not?
You can't really temporarily "exit" a remote session to local host, execute a command (in the same script) in the local host, and then continue the same script running in the remote host...
(at least that is how I read your script in the first message...)
ok thank you, it is what I thought.
But if I can just leave the remote session, Do I need to do 2x exit, exit to leave script and exit again to leave remore session? To do scp after from computer
What I don't understand is that if the script is located at the router and you are runnign it there, why do you need to try running the scp at the local PC in the middle?
Why not just run the scp from the router? in style of scp root@my_pc:/run/media/perkel/dnscrypt-proxy.toml /etc/dnscrypt-proxy2/
Ok. scp root@my_pc... i did not know
Usually I only use scp PC to router or vice versa.
But now is not to send file from router to pc but router to copy File from PC to bring back to router.