luis84
July 23, 2020, 6:48pm
1
hi guys I would like to start a script on boot
sh /root/sms.sh
on openwrt 19.07.
this script has no end, it reads a file every 2 seconds.
i tried with
#! / bin / sh /etc/rc.common
but it crashes the whole system ..
how can I do ..?
hnyman
July 23, 2020, 7:16pm
2
You can start the script in a detached shell:
e.g. add this to /etc/rc.local:
( /root/sms.sh )&
Ps. make sure to specify the correct directory or place the script on a directory that is in path.
Earlier discussion:
Why do you talk specifically about "bash" in the topic title, while your script is written for "sh" and is actually run by "ash" in busybox. Or have you really installed the bash shell and defined that it is used?
You might achieve the daemonising also by launching the script in a detached shell from /etc/rc.local (that is run at the end of the boot process)
e.g. add this to /etc/rc.local:
( script_vpn.sh )&
Ps. make sure to specify the correct directory or place the script on a directory th…
Sounds pretty crazy that the referenced script logs into flash every five seconds But that is just wiki advice...
It might make sense to run the periodic check script from a detached shell, so that it would certainly not block any further script evaluation. E.g like this:
( /path-to-script/script.sh )&
2 Likes
luis84
July 24, 2020, 4:50am
3
hnyman:
/etc/rc.local:
thanks a lot of advice
the same script launched by shell works fine,
but not since boot in
/etc/rc.local.
here is a screeshot of the top command that sees sms.sh and sees the command but does not go ..
maybe there are problems with sshpass