1) to be able to update the pi, I have set up scripts that check
git-lab API once a day and download the repo when there is a new
version. is this common, is it acceptable?
Yes, also you can follow the procedure below. It's easy to create a scheduled script thanks to the "cron".
1. Create a file for the script:
sudo touch /home/update-script
2. Open the script file:
sudo nano /home/update-script
3. Add these lines to the file:
# First updating the repository list
/usr/bin/sudo apt-get update
# Then upgrade packages etc
/usr/bin/sudo apt-get -y upgrade
# Finally rpi-update
# Trigger a reboot
/usr/bin/sudo shutdown -r
-e after the
#!/bin/bash will stop this script if any errors occur.
4. Add execute permission to this script file (not much force):
sudo chmod +x /home/update-script
5. Schedule the script, fire the command below and select nano if it asks you:
6. Add this line:
0 3 * * * /home/update-script 2>&1 >/home/update-script.output
It will run this script at 3 am every day and make an output file for logging. Moreover, if you want to change the scheduled time as you want, the structure is like this: Source
# * * * * * command to execute
# ┬ ┬ ┬ ┬ ┬
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └───── day of the week (0 - 7) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
# │ │ │ └────────── month (1 - 12)
# │ │ └─────────────── day of the month (1 - 31)
# │ └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)
It all makes you able to update the raspberry pi/raspbian automatically.
2) the Raspberry pi keeps track of the version of the file by writing
than into a text-file, should I use a database instead?
If it's related to the question number one, No. However, if you write things in a simple file, it's easy to use but it's also risky. The databases always are much reliable but a bit hard to configure and make a connection for your programs, script, etc anyway.
3) I disabled SSH, for security and data cap. however, I have a script
that checks GitHub for a file and executes commands if there is any on
that file. is this acceptable?
Short answer, almost everything is acceptable if you are working on a Linux box. You execute commands on a local machine. It doesn't matter if the SSH enabled or disabled.