OpenWRT 在后台执行命令

在升级 OpenWRT 中软件的过程中为了防止终端断开连接使软件升级失败,可以使用如下的命令进行升级

setsid sh -c "opkg update && opkg list-upgradable | grep -E 'sing-box|momo|xray' | cut -d ' ' -f 1 | xargs -r opkg upgrade && touch /tmp/opkg-upgrade-done.txt" &

检查是否还在运行

ps | grep opkg
# or
ls -alh /tmp/opkg-upgrade-done.txt

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>