Page 1 of 1

Frontier Elite Project

Posted: Thu Nov 08, 2018 9:43 am
by David Cummings
Hi All,
As I have gone and gotten myself TOTALLY obsessed with Frontier Elite, I am going to re-purpose one of my unused Raspberry Pi 2B as a little forum/file server for my little group. It is only about 10 members in total.

My plan is to set up the PI as a private forum server, with phpbb, MySQL, php7, and Apache, PHPMYADMIN and RpiMon (cause its pretty). And Also some kind of virus scanner.

I want to be able to allow people to upload any files etc to a storage space within the RPI.

That's all fine I am sure I can figure that out, as well as the NAT stuff from my cable supplier.

What I want to do is to be able to, at midnight every night for the RPI to perform a cron job that will -

1. Backup the MYSQL database for the forum.
1.1 Upload this backup to a file on the NAS - \backups\Elite\RPI-MYSQL\<foldername as date and time> (e.g. 2018-11-08)
2. Backup any files uploaded, to the NAS - \backups\Elite\RPI-STORE\<foldername as date and time> (e.g. 2018-11-08)
3. Email me when it's done.

The RPI will be called "Elite" on ip address ending 0.2
The external storage space is a NAS box, on ip ending 0.3

Can anyone point me in the right direction?

Re: Frontier Elite Project

Posted: Thu Nov 08, 2018 10:07 am
by topguy

Re: Frontier Elite Project

Posted: Thu Nov 08, 2018 10:31 am
by David Cummings
Hi,
Yes and no

they have a new version out - Frontier Elite Dangerous https://www.frontierstore.net/games/eli ... s-cat.html

Its a remake, with around 400 BILLION stars

Re: Frontier Elite Project

Posted: Thu Nov 08, 2018 11:02 am
by topguy
That is what I thought but I had only seen that referred to as "Elite: Dangerous" ( I own it, but havent played it much )

Re: Frontier Elite Project

Posted: Thu Nov 08, 2018 11:26 am
by PhatFil
how large is the expected daily backup? if measured in single digit MB and your nas has a TBs of space then you may want to just keep everything and schedule a 6-12 monthly housekeeping session.. Otherwise you may wish to only maintain the last 7 days of backups and perhaps a years worth of month start/end backups too. keeping at least one set of backups on remote or cloud storage is an easy local disaster proof strategy, in the bad old days i used to lump a set of tapes off site with me every night ;)

shame i dont own a puter capable of playing the new game ;( my only recollections of elite are on a bbc micro ( or was it an Archimedes? ) round my pals house, when you spent ages travelling between space stations and then crashed (well i did) attempting to match the rotation of the station to dock

Re: Frontier Elite Project

Posted: Thu Nov 08, 2018 11:35 am
by David Cummings
Hi
I'm guessing pretty small tbh but as my nas has 16tb space I'm not over concerned about space issues lol.
It's a very addictive game I used to play it on the amiga but lost interest as I found girls and dating and drinking etc and the lack of multiple player....
Now it's back though and really good you can do multiple player trade runs and the Stella cartography is awesome I find myself just clicking and exploring on that screen.

Re: Frontier Elite Project

Posted: Thu Nov 08, 2018 4:47 pm
by pfletch101
David Cummings wrote:
Thu Nov 08, 2018 9:43 am
What I want to do is to be able to, at midnight every night for the RPI to perform a cron job that will -

1. Backup the MYSQL database for the forum.
1.1 Upload this backup to a file on the NAS - \backups\Elite\RPI-MYSQL\<foldername as date and time> (e.g. 2018-11-08)
2. Backup any files uploaded, to the NAS - \backups\Elite\RPI-STORE\<foldername as date and time> (e.g. 2018-11-08)
3. Email me when it's done.

The RPI will be called "Elite" on ip address ending 0.2
The external storage space is a NAS box, on ip ending 0.3

Can anyone point me in the right direction?
A couple of notes:
1) I assume that you know that you should use mysqldump to make a valid backup of MySQL database - not just copy the database files. The latter may work if you can guarantee that no-one is doing anything that affects the database while you are copying it, but is not recommended.
2) The following crontab lines implement a backup system (using some short Python scripts) which create zipped backups of SQLite files containing my weather data every day, with the daily data kept for a week, the weekly data kept for a month, and the monthly data kept indefinitely. I do just zip the 'raw' files because the software which writes to them only does so (for a few seconds) every 5 minutes, so I know that they are not otherwise being accessed on odd minutes.

Code: Select all

2 23 * * * sh /home/pi/weather/DBackup.sh
1 23 8,15,22 * * sh /home/pi/weather/WBackup.sh
1 23 1 * * sh /home/pi/weather/MBackup.sh
The following is the script that does the daily backup. The other scripts are very similar, except that they don't need or have any tests to avoid the days when the other levels of backup run (cron handles this) and they create appropriate names:

Code: Select all

import datetime
import zipfile
import os
import time

# save temp/humidity and weather data as archive to NAS backup area
# version to run daily (except on days 1,8,15,22 when weekly and monthly
# backups run)

thisDate = datetime.date.today()
thisDay = thisDate.day
if ((thisDay % 7) != 1) or (thisDay == 29):
    outFile = "/mnt/mycloud/TBackup/daily/" + thisDate.strftime("%A") + ".zip"
    testFile = "/mnt/mycloud/TBackup/TestFile.txt"
    try:
        truth = os.path.getsize(testFile) > 0
    except:
        time.sleep(30)
# if the file existence test times out because the disk needs too much time to spin up, the sleep will allow it to do so before
# the next line tries to read or create the real output file. If it fails for a 'hard' reason, the next line will fail, too,
# and the script will be aborted
    myFile = zipfile.ZipFile(outFile, 'w')
    myFile.write("data.db", compress_type=zipfile.ZIP_DEFLATED)
    myFile.write("/var/lib/weewx/weewx.sdb", arcname="weewx.sdb",compress_type=zipfile.ZIP_DEFLATED)
    myFile.close()