Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow script long options #8

Merged
merged 1 commit into from
Sep 11, 2020
Merged

Allow script long options #8

merged 1 commit into from
Sep 11, 2020

Conversation

LukeShirnia
Copy link
Owner

Resolves issue #5

Usage: disk_usage_check.sh [-f] [-b] [-h]
           -f, --filesystem <filesystem>  Specify a Filesystem
           -b, --bbcode                   Print with bbcode
           -h, --help                     Print help (usage)

Invalid long option

$ bash disk_usage_check.sh --random
Invalid option: --random
Usage: disk_usage_check.sh [-f] [-b] [-h]
           -f, --filesystem <filesystem>  Specify a Filesystem
           -b, --bbcode                   Print with bbcode
           -h, --help                     Print help (usage)

Invalid short option

$ bash disk_usage_check.sh -r
Invalid option: r
Usage: disk_usage_check.sh [-f] [-b] [-h]
           -f, --filesystem <filesystem>  Specify a Filesystem
           -b, --bbcode                   Print with bbcode
           -h, --help                     Print help (usage)

Combination of short and long options:

$ bash disk_usage_check.sh --bbcode -f /boot


============================================================ 
 	 == /boot Filesystem Information == 
============================================================ 

[code]
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sda6      ext4  3.9G  284M  3.4G   8% /boot

Filesystem     Type Inodes IUsed  IFree IUse% Mounted on
/dev/sda6      ext4 258560   416 258144    1% /boot
[/code]

============================================================ 
 	 == Largest Directories == 
============================================================ 

[code]
236M  total
236M  /boot
16K   /boot/lost+found
8.0K  /boot/loader
4.0K  /boot/loader/entries
4.0K  /boot/grub2
4.0K  /boot/efi
1.1M  /boot/extlinux
[/code]

============================================================ 
 	 == Largest Files == 
============================================================ 

[code]
79.54M  /boot/initramfs-0-rescue-bcb9ae7409a94ea48a6dc8a5fe6c8077.img
32.86M  /boot/initramfs-5.8.6-201.fc32.x86_64.img
32.54M  /boot/initramfs-5.7.15-100.fc31.x86_64.img
32.43M  /boot/initramfs-5.7.11-100.fc31.x86_64.img
11.12M  /boot/vmlinuz-5.8.6-201.fc32.x86_64
10.32M  /boot/vmlinuz-5.7.11-100.fc31.x86_64
10.32M  /boot/vmlinuz-5.7.15-100.fc31.x86_64
8.89M   /boot/vmlinuz-0-rescue-bcb9ae7409a94ea48a6dc8a5fe6c8077
5.08M   /boot/System.map-5.8.6-201.fc32.x86_64
4.93M   /boot/System.map-5.7.15-100.fc31.x86_64
4.93M   /boot/System.map-5.7.11-100.fc31.x86_64
0.22M   /boot/config-5.8.6-201.fc32.x86_64
0.21M   /boot/config-5.7.15-100.fc31.x86_64
0.21M   /boot/config-5.7.11-100.fc31.x86_64
0.18M   /boot/elf-memtest86+-5.01
0.18M   /boot/memtest86+-5.01
0.18M   /boot/extlinux/libcom32.c32
0.16M   /boot/extlinux/hdt.c32
0.11M   /boot/extlinux/ldlinux.c32
0.10M   /boot/extlinux/liblua.c32
[/code]

============================================================ 
 	 == OK Check List == 
============================================================ 

The following have been checked and are ok: 

[OK]      No Volume groups (vgs) found
[OK]      No open DELETED files over 500MB
[WARNING] /home/rack does not appear to exist

============================================================

Single long option

$ bash disk_usage_check.sh --filesystem /boot


============================================================ 
 	 == /boot Filesystem Information == 
============================================================ 

Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sda6      ext4  3.9G  284M  3.4G   8% /boot

Filesystem     Type Inodes IUsed  IFree IUse% Mounted on
/dev/sda6      ext4 258560   416 258144    1% /boot

============================================================ 
 	 == Largest Directories == 
============================================================ 

236M  total
236M  /boot
16K   /boot/lost+found
8.0K  /boot/loader
4.0K  /boot/loader/entries
4.0K  /boot/grub2
4.0K  /boot/efi
1.1M  /boot/extlinux

============================================================ 
 	 == Largest Files == 
============================================================ 

79.54M  /boot/initramfs-0-rescue-bcb9ae7409a94ea48a6dc8a5fe6c8077.img
32.86M  /boot/initramfs-5.8.6-201.fc32.x86_64.img
32.54M  /boot/initramfs-5.7.15-100.fc31.x86_64.img
32.43M  /boot/initramfs-5.7.11-100.fc31.x86_64.img
11.12M  /boot/vmlinuz-5.8.6-201.fc32.x86_64
10.32M  /boot/vmlinuz-5.7.11-100.fc31.x86_64
10.32M  /boot/vmlinuz-5.7.15-100.fc31.x86_64
8.89M   /boot/vmlinuz-0-rescue-bcb9ae7409a94ea48a6dc8a5fe6c8077
5.08M   /boot/System.map-5.8.6-201.fc32.x86_64
4.93M   /boot/System.map-5.7.15-100.fc31.x86_64
4.93M   /boot/System.map-5.7.11-100.fc31.x86_64
0.22M   /boot/config-5.8.6-201.fc32.x86_64
0.21M   /boot/config-5.7.15-100.fc31.x86_64
0.21M   /boot/config-5.7.11-100.fc31.x86_64
0.18M   /boot/elf-memtest86+-5.01
0.18M   /boot/memtest86+-5.01
0.18M   /boot/extlinux/libcom32.c32
0.16M   /boot/extlinux/hdt.c32
0.11M   /boot/extlinux/ldlinux.c32
0.10M   /boot/extlinux/liblua.c32

============================================================ 
 	 == OK Check List == 
============================================================ 

The following have been checked and are ok: 

[OK]      No Volume groups (vgs) found
[OK]      No open DELETED files over 500MB
[WARNING] /home/rack does not appear to exist

============================================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant