@@ -61,6 +61,8 @@ The overview page can also be reached with your raspberry pi IP address, but you
http://localhost/cgi-bin/overview.cgi
Sometimes I had problems reaching the page when the raspberry pi was connected to the eduroam wifi, however I did not have the same problem connecting to my wifi at home.
In this script I got much help from this two websites:
@@ -70,7 +72,7 @@ In this script I got much help from this two websites:
<h2>Crontab entries (systemd)</h2>
I did the optional task which means that I created a systemd timer unit instead of a crontab entry. The systemd runs the main.sh script automatically every 6th hour. A systemd timer unit includes two files, schedule-exam.service and schedule-exam.timer, which haves to be inside /etc/systemd/user. For now it is stored inside the config folder. I have made the optional deployment script which copy (cp) these files from the folder and makes the files inside the right directory. The schedule-exam.service file describes the job the schedule-exam.timer schould do. In other words, the schedule-exam.service contains which script it should run and the schedule-exam.timer contains when it should run.
First I tried to schedule the timer with this command:
First I tried to schedule the timer with this command inside the schedule-exam.timer:
OnUnitActiveSec=6h
...
...
@@ -78,7 +80,7 @@ It worked well until I disconnected my raspberry pi and reconnected to it. The s
systemctl --user start schedule-exam.timer
I discored this when I run this command:
I discovered this when I run this command:
systemctl --user status schedule-exam.timer
...
...
@@ -102,18 +104,13 @@ In this script I got much help from this website:
<h2>gitrepo.sh</h2>
The gitrepo.sh script is an optional task and updates the local and the centralized git repository. Inside this script I run the git commands to push all the changes that have been done after running the other scripts. This includes the git command git add, git commit and git push. To add all the changes I wrote a dot to get all the changed and new files. In the commit message I included the date to see when it was pushed automatically. I also included that it is an automatic push so it is possible to see if the commit is pushed manually or automatically. Since this script also runs automatic by systemd every 6th hour it requires a ssh key or a token, if not it asks for the username and the password for the gitlab. I chose to use a token, because of security. The ssh key has an option of making a passphrase, but then the user have to write it down everytime it runs which is pointless. It is possible to not give the ssh key a passprase, but this is not a secure way of doing it. Therefore I made a token in gitlab to clone the project with https. I made a project token so the token can just be used with this project only. I gave the token the role maintainer and the scope api. I configurated the bot in the terminal:
Then clone the project in this way, replacing the $PROJECT_TOKEN with the actual token:
The gitrepo.sh script is an optional task and updates the local and the centralized git repository. Inside this script I run the git commands to push all the changes that have been done after running the other scripts. This includes the git command git add, git commit and git push. To add all the changes I wrote a dot to get all the changed and new files. In the commit message I included the date to see when it was pushed automatically. I also included that it is an automatic push so it is possible to see if the commit is pushed manually or automatically. Since this script also runs automatic by systemd every 6th hour it requires a ssh key or a token, if not it asks for the username and the password for the gitlab. I chose to use a token, because of security. The ssh key has an option of making a passphrase, but then the user have to write it down everytime it runs which is pointless. It is possible to not give the ssh key a passprase, but this is not a secure way of doing it. Therefore I made a token in gitlab to clone the project with https. I made a project token so the token can just be used with this project only. I gave the token the role maintainer and the scope api. Then cloned the project inside home/pi/git:
Finally I made the deployment script. The deployment.sh is an optional script and will configurate a blank installation of raspberry pi os with all that is necessary for the project to work. Firstly the script installs all the programs that I have used to solve this assignment. Then making a git directory inside home/pi and clone the git repository with https inside this directory. This will make an exam directory with all the scripts inside and one config folder with all the configuration files. Then the script will copy the configuration files and the overview.cgi and place it inside the right directory as well as enable and start it. Finally available all the scripts with the chmod +x command. However you have to manually enable the deployment.sh before you run it:
Finally I made the deployment script. The deployment.sh is an optional script and will configurate a blank installation of raspberry pi os with all that is necessary for the project to work. Firstly the script installs all the programs that I have used to solve this assignment. Then making a git directory inside home/pi and clone the git repository with https inside this directory. This will make an exam directory with all the scripts inside as well as one config folder with all the configuration files. Then the script will copy the configuration files and the overview.cgi and place it inside the right directory as well as enable and start it. Finally available all the scripts with the chmod +x command. However you have to manually enable the deployment.sh before you run it: