DA Update Script

cjd

Verified User
Joined
Feb 1, 2021
Messages
355
Location
Canada
Been testing beta on a couple of servers/vms and got tired of looking up the uid/lid numbers for the servers, so threw together a script to do it all for me. I noticed that what I needed was always in the setup.txt file on the servers/vms. Added in a little extra checking top stop the script if things are missing, and just do the update for me. It saves the previous update file in case it's needed to roll back.

Just thought I would share.

It's an adaption of this page: https://help.directadmin.com/item.php?id=408

As usual USE AT YOUR OWN RISK. Always make backups. If you don't understand how this works don't use it.

Bash:
#!/bin/bash

# This script will use the setup file to determine User ID number and License ID number to fetch and update Direct Admin
# Caution: Use at your own risk.  Only tested on Debian 9 & 10.

release='beta'
setuptxt='/usr/local/directadmin/scripts/setup.txt'

[[ -f $setuptxt ]] || { printf '%s does not exist!\n' "$setuptxt" ; exit 1; }

uid=$( grep --color=never -Po "^uid=\K.*" "$setuptxt" || true)
lid=$( grep --color=never -Po "^lid=\K.*" "$setuptxt" || true)

[[ -z "$uid" ]] && { echo "User ID Number not found in setup file" ; exit 1; }
[[ -z "$lid" ]] && { echo "License ID Number not found in setup file" ; exit 1; }

cd /usr/local/directadmin
mv new.tar.gz new.tar.gz-old
wget --no-check-certificate -O new.tar.gz "https://www.directadmin.com/cgi-bin/daupdate?redirect=no&uid=$uid&lid=$lid&channel=$release"
tar xvzf new.tar.gz
./directadmin p
scripts/update.sh
killall -9 directadmin
./directadmin d

Hopefully this is an appropriate area to post this.
 
Is this this just to update directadmin? I think Custombuild does this for you automatically.
 
Yes, to update to the latest beta/pre-release of directadmin to do testing. I was just tired of looking up the numbers on a couple machines and copy paste everything, this just it on it's own. Thought it might be useful for other people testing betas. It doesn't update anything else just the control panel.
 
Directadmin has its own script to switch version easily with more options:

Code:
root@code:/usr/local/directadmin/scripts# ./getDA.sh
Usage:
    ./getDA.sh alpha
    ./getDA.sh beta
    ./getDA.sh current
    ./getDA.sh stable
    ./getDA.sh [commit-hash]

So to switch to beta version, you do this

Code:
./getDA.sh beta
 
When I tossed that script together it didn't have that function. Your responding to an old thread.
 
When I tossed that script together it didn't have that function. Your responding to an old thread.

Ah.. sorry about that, I didn't know that was an old post (was clicking on the 'new posts' link in forum and it recommends this as the top new post. Something is wrong with xenforo recommendation)

Also I notice the documentation is new updated on Jul 13, 2021 2 months after your post.
 
Back
Top