Hello newtoaixos,
We can give you basic idea, then kindly try by yourself and let us know if you face any issues, as our forum's aim is to help each person to learn.
Here are some points by which you can start your script.
- you can take threshould of filesystem when you want to nullify the large size log file in a variable.
- you can then use if else statements to check the disk space if this condition is TRUE means if threshould of Disk space crosses then you can nullify the file by the command which you have given. (Not sure if this will allow us to nullify logs as some processes needs to be stopped first then they will allow to nullify the log files.)
Please try it by your self and let us know if you have queries. Also you can always refer
man if or
man test for your help too.
EDIT: Also kindly use code tags for commands and codes which you are going to mention in your post, you can use the preview post option too before posting.
Thanks,
R. Singh