Script that mounts and checks if a file has been modified

558fe5180e0e8fc922d31c23ef84d240

First, it has been a LONG time since Ive been here. Good memories from when I was young.

Anyways

In a monitoring system I have, I had a plugin that remotely checked a SMB share and if the file hasnt been modified in 1 day, it should return a warning. if it is 2 days or more, it should return a critical.

Returning the warning and the critical isnt the issue, its the entire logic of the script itself.

I mean, I dont think it should be too difficult but Im not used to shell scripting. Also, the downfall exists, of having to check if the mount is correct, etc.

The logic is basically

inputvariable warningdays
inputvariable criticaldays
inputvariable smbpath
mount smbpath to final folder /mnt/folder
if mount is unsuccessful
return unknown
if mount is successful
if /mnt/folder/file does not exist
return unknown
if /mnt/folder/file does exist
if /mnt/folder/file has been written to less than warningdays
return ok
if /mnt/folder/file has been written to more than warningdays and less than criticaldays
return warning
if /mnt/folder/file has been written to more than criticaldays
return critical
if previousoperations are done
unmount
if unmount is unsuccessful
return unknown
finish

Could someone tell me the basics of the shell script?

Thank you.

A First Look at CSS When and Else Statements

Category Image 052

In CSS, we make selections of different devices by using media queries. Media queries give us an easy way to select devices based on numerous conditions, such as screen size, pixel density, or even format: i.e., print or screen.

This has progressively gotten more complicated over time, and now we are often balancing many conditions that sometimes conflict with each other.