相关疑难解决方法(0)

如何在后台运行脚本(linux openwrt)?

我有这个脚本:

#!/bin/sh
while [ true ] ; do
    urlfile=$( ls /root/wget/wget-download-link.txt | head -n 1 )
    dir=$( cat /root/wget/wget-dir.txt )
    if [ "$urlfile" = "" ] ; then
        sleep 30
        continue
    fi

    url=$( head -n 1 $urlfile )
    if [ "$url" = "" ] ; then
        mv $urlfile $urlfile.invalid
        continue
    fi

    mv $urlfile $urlfile.busy
    wget -b $url -P $dir -o /www/wget.log -c -t 100 -nc
    mv $urlfile.busy $urlfile.done
done
Run Code Online (Sandbox Code Playgroud)

该脚本基本上wget-download-link.txt每30秒检查一次新的URL,如果有一个新的URL,它将用wget下载,问题是当我尝试在Putty上运行这个脚本时这样

/root/wget/wget_download.sh --daemon
Run Code Online (Sandbox Code Playgroud)

它仍然在前台运行,我仍然可以看到终端输出.如何让它在后台运行?

linux shell ash

5
推荐指数
2
解决办法
1万
查看次数

标签 统计

ash ×1

linux ×1

shell ×1