netapp trimming log files via cronjob

Most (if not all) management on ONTAP can be done from the CLI or SystemManager.
If you want to run some scripts of your own, there is a way to do that.

If you are not familiar with UNIX/Linux, don't go there.

You need access to the systemshell.
cl1::> security login unlock -username diag
cl1::> security login password -username diag
(enter the password twice)

Go to diag mode and access the systemshell
cl1::> set d

Warning: These diagnostic commands are for use by NetApp personnel only.
Do you want to continue? {y|n}: y

cl1::*> systemshell -node cl1-01
(system node systemshell)
diag@127.0.0.1's password: ******

Warning: The system shell provides access to low-level
diagnostic tools that can cause irreparable damage to
the system if not used properly. Use this environment
only when directed to do so by support personnel.

cl1-01%

Note: (As stated above, this is not something you should do if not
really necessary)

Now that you are in the systemshell you can manage the UNIX environment
to a certain extent.

First, you become root.
cl1-01% sudo bash
bash-3.2#

Example case:
I am bothered by all these logfiles taking up space in vol0 of my simulator.
I create a script that gets rid of the log retention and make it executable.

bash-3.2# echo "rm -f /mroot/etc/log/*000*" > /mroot/etc/get_rid
bash-3.2# echo "rm -f /mroot/etc/log/mlog/*000*" >> /mroot/etc/get_rid
bash-3.2# chmod +x /mroot/etc/get_rid

This script will remove all archived logfiles.
Now I decide to do that every day at midnight.

bash-3.2# crontab -e
(now you are in vi)
i
0 0 * * * /mroot/etc/get_rid
~
~

:
:wq!
(now you are no longer in vi and you have created a crontab entry for root)

This crontab entry will remove all files that contain *000* in the name from
/mroot/etc/log and from /mroot/etc/log/mlog. And it will do that at 0 minutes
at 0 hours every day of the month every month of the year every day of the week.

To check whether your entry in cron is ok.
bash-3.2# crontab -l
0 0 * * *  /mroot/etc/get_rid

bash-3.2# exit
cl1-01% exit
logout

cl1::*>

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.