please note, edit the directory names for your use!
- it checks if there are opened connections
- stops the wftpserver service
- backups your Data-directory
- download and extract the new version
- start the wftpserver service
Code: Select all
#!/bin/bash
#
# CHECK IF THERE ARE OPENED CONNECTIONS
########################################
if [ `ls -1a /opt/wftpserver/session/|wc -l` -gt 2 ];
then echo "There are opened Connections -> Update canceled";
else
# STOP THE FTP-SERVICE
#######################
/etc/init.d/wftpserver stop
#
#
# BACKUP YOUR SETTINGS
#######################
rm -rf /opt/wftpserver_update/Data_bak
mkdir /opt/wftpserver_update/Data_bak
cp -r /opt/wftpserver/Data/* /opt/wftpserver_update/Data_bak
tar czvf /opt/wftpserver_update/Backup_files/Data_Backup_upd_$(date +"%Y.%m.%d_%H%M").tar.gz /opt/wftpserver_update/Data_bak
rm -rf /opt/wftpserver_update/Data_bak
#
#
#
# DOWNLOAD AND EXTRACT THE NEWEST VERSION
##########################################
wget http://www.wftpserver.com/download/wftp ... bit.tar.gz -O /opt/wftpserver_update/new_version.tar.gz
tar -xzvf /opt/wftpserver_update/new_version.tar.gz -C /opt
rm -rf /opt/wftpserver_update/new_version.tar.gz
#
# START THE FTP-SERVICE
########################
/etc/init.d/wftpserver start
#
fi