check_vsftp.sh
654 Bytes
#!/bin/bash
flag=$1
host=$2
exist=`dpkg -l|grep vsftpd`
if [[ ! $exist && $flag == 0 ]]
then
if [[ -f /etc/vsftpd.conf ]];then
rm /etc/vsftpd.conf
fi
dpkg -i vsftpd_3.0.3-9build1_arm64.deb
systemctl disable vsftpd.service
echo 0
elif [[ $exist && $flag == 0 && `pgrep vsftpd` ]]
then
echo true
elif [[ ! $exist && $flag == 1 ]]
then
wget --ftp-user=ubuntu --ftp-password=ubuntu ftp://$host/tx2_update/vsftpd_3.0.3-9build1_arm64.deb
dpkg -i vsftpd_3.0.3-9build1_arm64.deb
rm vsftpd_3.0.3-9build1_arm64.deb
systemctl disable vsftpd.service
fi
sed -i 's/^#write_enable=YES$/write_enable=YES/' /etc/vsftpd.conf
systemctl restart vsftpd.service