diff --git a/README.md b/README.md index c68c708..9a80a9d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,40 @@ # SPRKLstats -Statistics for motd on spoorkuil \ No newline at end of file +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. + + diff --git a/config.py b/config.py index 3b44b39..00bc516 100644 --- a/config.py +++ b/config.py @@ -1,3 +1,5 @@ +# Author: Stefan Weijers https://github.com/Stxfie + class bcolors: EMPTY = '\033[34m' #BLUE MIDWAY = '\033[33m' #YELLOW diff --git a/diskusage.py b/diskusage.py index 3854296..6a2720a 100644 --- a/diskusage.py +++ b/diskusage.py @@ -1,3 +1,5 @@ +# Author: Stefan Weijers https://github.com/Stxfie + import os from config import bcolors,env diff --git a/init.py b/init.py new file mode 100644 index 0000000..19ed793 --- /dev/null +++ b/init.py @@ -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!') diff --git a/services.py b/services.py index 1a95b50..14307a3 100644 --- a/services.py +++ b/services.py @@ -1,3 +1,5 @@ +# Author: Stefan Weijers https://github.com/Stxfie + import os from config import bcolors,env diff --git a/start.sh b/start.sh deleted file mode 100755 index b6278f4..0000000 --- a/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -python3 ./time.py -echo -python3 ./diskusage.py -echo -python3 ./services.py diff --git a/time.py b/time.py index 4127533..b0dc34a 100644 --- a/time.py +++ b/time.py @@ -1,3 +1,5 @@ +# Author: Stefan Weijers https://github.com/Stxfie + import os from config import bcolors,env