#!/bin/bash
BACKUP_PATH='/root/backup/'
if [ ! -d $BACKUP_PATH ]; then
mkdir -p $BACKUP_PATH
fi
wget https://github.com/traccar/traccar/releases/download/v4.7/traccar-linux-64-4.7.zip
unzip traccar-linux-*.zip
sudo cp /etc/systemd/system/traccar.service /root/backup/traccar.service
sudo cp /opt/traccar/conf/default.xml /root/backup/default.xml
sudo cp /opt/traccar/conf/traccar.xml /root/backup/traccar.xml
sudo cp /opt/traccar/conf/wrapper.conf /root/backup/wrapper.conf
sudo systemctl stop traccar.service
sudo systemctl disable traccar.service
sudo rm /etc/systemd/system/traccar.service
sudo systemctl daemon-reload
sudo rm -R /opt/traccar
sudo ./traccar.run
sudo cp /root/backup/traccar.service /etc/systemd/system/traccar.service
sudo systemctl daemon-reload
sudo cp /root/backup/default.xml /opt/traccar/conf/default.xml
sudo cp /root/backup/traccar.xml /opt/traccar/conf/traccar.xml
sudo cp /root/backup/wrapper.conf /opt/traccar/conf/wrapper.conf
sudo systemctl start traccar.service
sudo rm -f traccar.run README.txt traccar-linux-*.zip
#!/bin/bash #---------------------------------------- # OPTIONS #---------------------------------------- BACKUP_PATH='/root/backup/' # Create the backup folder if [ ! -d $BACKUP_PATH ]; then mkdir -p $BACKUP_PATH fi # Download Traccar wget https://github.com/traccar/traccar/releases/download/v4.7/traccar-linux-64-4.7.zip # Unzip Traccar unzip traccar-linux-*.zip # Backup config files sudo cp /etc/systemd/system/traccar.service /root/backup/traccar.service sudo cp /opt/traccar/conf/default.xml /root/backup/default.xml sudo cp /opt/traccar/conf/traccar.xml /root/backup/traccar.xml sudo cp /opt/traccar/conf/wrapper.conf /root/backup/wrapper.conf # Remove Traccar sudo systemctl stop traccar.service sudo systemctl disable traccar.service sudo rm /etc/systemd/system/traccar.service sudo systemctl daemon-reload sudo rm -R /opt/traccar # Install Traccar sudo ./traccar.run # Restore config files sudo cp /root/backup/traccar.service /etc/systemd/system/traccar.service sudo systemctl daemon-reload sudo cp /root/backup/default.xml /opt/traccar/conf/default.xml sudo cp /root/backup/traccar.xml /opt/traccar/conf/traccar.xml sudo cp /root/backup/wrapper.conf /opt/traccar/conf/wrapper.conf # Run Traccar sudo systemctl start traccar.service # Clear sudo rm -f traccar.run README.txt traccar-linux-*.zip