我试图在我的ssh服务器上编写一个用于淹没的脚本,但是我很难检查进程是否一直在运行。它总是认为汹涌澎湃。我拒绝所有iptable设置,并且除非我每次运行它都设置这些规则,否则我真的不知道如何使它工作。
#!/bin/bash
#starts deluged and deluge console
echo "Start or Close Deluge?"
read startcls
if [[ $startcls == "S" || $startcls == "s" ]]; then
if [ -z "$(pgrep deluged)" ]; then
echo "Deluge Daemon already running. Close it?"
read input
if [[ $input == "y" || $input == "Y" ]]; then
pkill deluged
iptables -D OUTPUT -p tcp --dport 57714 -j ACCEPT
iptables -P INPUT DROP
echo "Deluged process terminated"
fi
else
iptables -A OUTPUT -p tcp --dport 57714 -j ACCEPT
iptables -P INPUT ACCEPT
deluged
echo "Deluge Daemon started"
deluge-console
fi
else
pkill deluged
iptables -D OUTPUT -p tcp --dport 57714 -j ACCEPT
iptables -P INPUT DROP
echo "Deluged process terminated"
fi
答案 0 :(得分:0)
可能是您的脚本名称中包含"淹没"在里面。将其更改为Deluge_check.sh(大写' D')