Get answers quicker by searching

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Bash script to simplify Sendy updates
  • Vote Up0Vote Down marcelopmarcelop
    Posts: 15Sendy user

    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 /bin/sh with /bin/bash
    • 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,
    Marcelo

  • 7 Comments
  • Vote Up0Vote Down AlejandroLAlejandroL
    Posts: 8Sendy user

    Wow, nice script... thanks you !

  • Vote Up0Vote Down sony3002sony3002
    Posts: 2Sendy user

    Thank you, me too implemented this on my server...

  • Vote Up0Vote Down applsysapplsys
    Posts: 3Sendy user

    Brilliant - thanks.

    I added a little backup to /tmp/ and removed the uploads directory from the new update just in case. Change the /var/www/html to where ever your sendy install is.

    
    #! /bin/sh
    cd /var/www/html; 
    tar -cvf /tmp/sendybackup.tar .
    wget https://sendy.co/download?license=[license]  -O sendy.zip;
    unzip sendy.zip;
    cp .htaccess sendy/.htaccess;
    rm -rf /sendy/uploads
    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 ./;
    

  • Vote Up0Vote Down dsecareanudsecareanu
    Posts: 4Sendy user

    Thanks for this bash script! I concur with the idea of a php script! It would be great to have a magical update button somewhere in the Sendy interface. :) I am sure a php script can be easily devised to make it painless.

  • I would use curl -O -J -L in case the sendy.co URL ever starts using redirects.

  • Vote Up0Vote Down buzzablebuzzable
    Posts: 14Sendy user

    Having automated update would be wonderful.

  • Vote Up0Vote Down sakumattosakumatto
    Posts: 2Sendy user

    If some of you are using translations (in my case fi_FI) you need to copy those over to the new version:

    mkdir /var/www/html/my.domain/sendy/locale/fi_FI cp -R /var/www/html/my.domain/public_html/locale/fi_FI /var/www/html/my.domain/sendy/locale/ cp -R /var/www/html/my.domain/public_html/uploads/ /var/www/html/my.domain/sendy

    --- pls replace /var/www/html/my.domain/ with your own path to Sendy