automaticly update your linux wftpserver installation

Post here if you have some suggestions or you want to request a new feature.
Post Reply
MountainVision
Posts: 10
Joined: Wed Mar 03, 2010 3:09 pm
Location: Laax, Switzerland
Contact:

automaticly update your linux wftpserver installation

Post by MountainVision »

just run this script on your server.
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
Post Reply