usage: sysadmin.sh [-a | -i | -s <service_name>] [-c] [-l <limit>] [-h]
Options (only choose one):
-s / --service <service_name> Permet to check a service existance, and / or
configure it
-i / --info Show some global system stats
-a / --all Show all services, and their characteristics
Other options:
-c / --cpu-monitoring Launch the CPU monitoring daemon
-l / --cpu-limit <limit> Set the CPU limit for warn of load (1-99). Set
this setting enable cpu monitoring
-h / --help Display this message
This is the sample of the school project we need to do to simpligy adminsys life.
Bash scripts are in the scripts folder, and the two files availables are :
- sysadmin.sh : permet to check the system or a specific program, and install it if needed
- cpuwarning.sh : permet to launch a process that warn if the cpu usage is too high
Those two files need to be in the same directory, and you only need to launch the sysadmin.sh script.
CPU warning instance is launched using the command screen with the name cpuwarning. To reattach to the tab, just do :
screen -r cpuwarning
(To quit without destroying the session, press CTRL-A then CTRL-D)
Those scripts were tested only on Ubuntu 16.04
Default text editor for configurations files is vim, you can set-up another (such nano) by setting-up an environment variable called EDITOR like in this example :
EDITOR=nano ./sysadmin.sh -s apache2
If you set another file editor, you need it to be able to edit multiple files simultaneously
A Vagrantfile for Vagrant is available to simplify test of this script (for Virtualbox provider).
To use Vagrant, just type the following in a terminal :
# Create the VM and / or launch it
vagrant up
# Connect to the VM with ssh
vagrant ssh
Scripts folder is available in default user home : /home/vagrant/scripts