1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| rm -f .bashrc
cat > .bashrc << EOF echo "<------------- init start ! -------------->" echo ""
# 启动 sshd if pgrep -x "sshd" >/dev/null then echo "~ > sshd started" else sshd >/dev/null echo "~ > sshd start success" fi
# 启动 mysql if pgrep -x "mysqld_safe" >/dev/null then echo "~ > mysql started" else mysqld_safe -u root >/dev/null & echo "~ > mysql start success" fi
# 启动 redis if pgrep -x "redis-server" >/dev/null then echo "~ > redis-server started" else redis-server /data/data/com.termux/files/usr/etc/redis.conf >/dev/null & echo "~ > redis-server start success" fi
# 启动 nginx if pgrep -x "nginx" >/dev/null then echo "~ > nginx started" else nginx >/dev/null echo "~ > nginx start success" fi
echo "" echo "<-------------- init end ! --------------->" echo "" EOF
|