Bash script to simplify Sendy updates
Hello guys, Ben, hope everything is ok there.
I deal with 6 Sendy installations for customers that have purchased the license, and every time a new version is released, the manual updating task is time consuming. So, I wrote this bash script to automatically update the installation, and after a couple iterations and corrections, I now have it working as a breeze and without errors.
Although, since this require the cPanel account containing the script to be able to provide access to jailed shell, I really would love to avoid this and have it in the form of PHP script, or even better, bundled as a feature of Sendy itself Hopefully, someone can provide that.
In the meantime, here I share the script for those who may need something alike, or even to point out fixes or improvements.
For this script to work, you must run it as the user. If you use cPanel, then first allow jailed shell to that account, and by connecting via SSH, you will land on
/home/username, then create a blank
sendy.sh file, and assign execution permssions to it:
chmod +x sendy.sh.
Then paste the below code inside. Take into account:
- For CentOS 6.x replace
[license]with your actual license string.
#! /bin/sh cd ./public_html; wget https://sendy.co/download?license=[license] -O sendy.zip; unzip sendy.zip; cp .htaccess sendy/.htaccess; cp includes/config.php sendy/includes/config.php; cp -R sendy/* .; rm sendy -drf; rm sendy.zip -f; chmod -R ugo-x,u+rwX,go+rX,go-w ./;
Then save, and to execute simply run:
./sendy.sh. If everything went well, it should not throw any errors. After execution is completed, go to your browser and login to your Sendy installation and it will automatically update the database accordingly. Just try to perform these tasks in hours where no emails are being sent, or at least notify you customers to schedule the process with enough anticipation in order to avoid any kind of issues.
Please consider this script was coded under CentOS 7.5 with cPanel. Other environments may have distinct rules/paths and you should always make a trustworthy backup before trying this solution. In my personal case, it updated Sendy in just 2 seconds.
Hope it helps anybody interested in this solution. And of course I'm open to suggestions.
All the best,