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.