Little Updater Script [LINUX] Open for Ideas



i have written for my own a little updater script for gogs. It works, if you have a 64 bit linux machine. You schould have installed curl and a user called git, who executete the gogs server. You schould have setup gogs as systemd service for automatic stop and restart.I am open for ideas or improvements, that was only the first draw i made. Testet on Ubuntu 16.04.

Best Regards

echo "Stoping Gogs"
systemctl stop gogs
echo "Delete the old backup"
rm -rf gogs_old
rm -rf
echo "Creating new backup"
mv gogs gogs_old
echo "Download latest version"
curl -s -L | egrep -o '/gogits/gogs/releases/download/[v][0-9\.]*\/' | wget --base= -i - -O
echo "Unzip Update"
echo "Copy Config from Backup to Update"
cp -R gogs_old/custom gogs
cp -R gogs_old/data gogs
cp -R gogs_old/log gogs
echo "Fix Permission"
chown -R git:git /home/git
echo "Start Gogs"
systemctl start gogs


You could try to put the relevant data into folders outside the gogs folder and follow some linux standards. logs to /var/log/gogs/, app.ini to /etc/gogs/, data to /var/lib/gogs/ and repositories to /var/lib/gogs/ or /srv/gogs/. Then you do not need to move and restore it; just unpack the new archive and restart with --config.


I dont know, but that must be configured in the /custom/app.ini and this way is for all users which want to use the default settings. You are right, the Linux standarts are not possible with this but you could change you config and the script easily if you need it in another way. You can also post your idea und er this post :slight_smile: