Deleted useless start.sh file, added author notes to all files, create

init file.
This commit is contained in:
Stefan Weijers 2021-07-25 21:36:30 +02:00
parent c805da08ae
commit 6b7a7c6784
7 changed files with 68 additions and 8 deletions

View File

@ -1,3 +1,40 @@
# SPRKLstats
Statistics for motd on spoorkuil
Statistics for motd on Spoorkuil VM
## Installation
1. Clone repo via https/ssh
```
https://git.dehosting.club/stefanw/SPRKLstats.git
```
2. Run init.py with escalated privileges
```
sudo python3 init.py
```
3. Check if works correctly by running
```
run-parts /etc/update-motd > /dev/null
```
## Usage
### Configuration
All configuration is done in `config.py`
#### Adding mounting points
In order to add extra mounting points to be displayed in SPRKLstats, you have to edit the mountpoints variable.
In the env class, there is a variable named mountpoints, simply add another entry into the list as a string.
#### Adding services
In order to add extra services to be displayed by SPRKLstats, you have to edit the services variable. This is a python dictionary, therefore there is specific syntax. A new entry is of the following syntax:
```python
'service name': 'Display Name'
```
Make sure entries are seperated with a comma.
#### Changing the text art
Simply change the name variable in the env class.

View File

@ -1,3 +1,5 @@
# Author: Stefan Weijers https://github.com/Stxfie
class bcolors:
EMPTY = '\033[34m' #BLUE
MIDWAY = '\033[33m' #YELLOW

View File

@ -1,3 +1,5 @@
# Author: Stefan Weijers https://github.com/Stxfie
import os
from config import bcolors,env

22
init.py Normal file
View File

@ -0,0 +1,22 @@
# Author: Stefan Weijers https://github.com/Stxfie
import os
from config import bcolors
#Create motd entry
try:
motdscript = open('/etc/update-motd/stats', 'w')
except:
print('[' + bcolors.FULL + 'IMPORTANT' + bcolors.RESET + ']')
print('Make sure you run the program as root!')
quit()
cwd = os.getcwd()
motdscript.write('#!/bin/bash\n{}/start.sh'.format(cwd))
#Create start script
startscript = open('start.sh', 'w')
startscript.write('#!/bin/bash\npython3 {}/time.py\necho\npython3 {}/diskusage.py\necho\npython3 {}/services.py'.format(cwd, cwd, cwd))
print('All done!')

View File

@ -1,3 +1,5 @@
# Author: Stefan Weijers https://github.com/Stxfie
import os
from config import bcolors,env

View File

@ -1,7 +0,0 @@
#!/bin/bash
python3 ./time.py
echo
python3 ./diskusage.py
echo
python3 ./services.py

View File

@ -1,3 +1,5 @@
# Author: Stefan Weijers https://github.com/Stxfie
import os
from config import bcolors,env