Not that it's hard to do manually of course, but why don't these support files get cleared automatically? I'm tempted to just write a script to remove files in that folder that are older than X days and set the script to run nightly or weekly in root's crontab. Any reason that would be a bad idea?
Thanks! I found a one-liner command using find and rm from a Google search that should work, but since I haven't tested it, I'll not post it here and wait to see what you've been using. Do you put yours in root's cron, or someone elses like nasadmin?
I got several syntax errors on your script so I just ended up using this simple one-liner:
find /nbsnas/var/emcsupport -type f -mtime +30 | xargs rm
(where +30 is any files older than 30 days)
So did you run your script under root's cron, or nasadmin's? Does it matter? Also, do user-added cron jobs go away when you perform a software upgrade?
as long as nasadmin has permissions to delete those files, you can put it in nasadmin crontab. Yes, your scripts might get canned whey ControlStation gets upgraded. Some CEs are nice and back it up for you and then put it back.
Thanks for the help. To anyone reading this with no experience with cron, it's just a unix schedular. You can access it by using
crontab -e
Which will launch the VI text editor and a blank file (since there is no existing scheduled jobs). VI, if you've never used it, is not the most user friendly text editor. Type "i" to begin typing your text, then enter
dynamox
9 Legend
•
20.4K Posts
3
January 3rd, 2013 20:00
you will need to ssh into the control station first, username: nasadmin, password:nasadmin (default password)
1) cd into the directory that contains support files
cd /nbsnas/var/emcsupport
2) list files in the directory, oldest files will be listed from top to bottom
ls -rtl
sample output:
[nasadmin@vnx5700 emcsupport]$ ls -rtl
total 451024
drwx------ 2 root root 16384 Jun 26 2011 lost+found
-rw-rw-r-- 1 nasadmin nasadmin 18853846 Sep 19 05:39 support_materials_APM00112300123.120919_0524.zip
-rw-rw-r-- 1 nasadmin nasadmin 17613070 Sep 26 03:20 support_materials_APM00112300123.120926_0305.zip
-rw-rw-r-- 1 nasadmin nasadmin 20445405 Sep 29 13:25 support_materials_APM00112300123.120929_1310.zip
-rw-rw-r-- 1 nasadmin nasadmin 22542514 Oct 1 17:12 support_materials_APM00112300123.121001_1643.zip
-rw-rw-r-- 1 nasadmin nasadmin 22486252 Oct 1 23:00 support_materials_APM00112300123.121001_2240.zip
-rw-rw-r-- 1 nasadmin nasadmin 17434964 Oct 3 03:22 support_materials_APM00112300123.121003_0306.zip
-rw-rw-r-- 1 nasadmin nasadmin 18239702 Oct 6 10:21 support_materials_APM00112300123.121006_1003.zip
3) now you can delete a bunch of files that are really old, i typically leave one month worth of files
rm -rf support_materials_APM00112300123.120919_0524.zip
rm -rf support_materials_APM00112300123.120926_0305.zip
...and so on
4) when you are done you can check this directory utilization
df -h /nbsnas/var/emcsupport
/dev/mapper/emc_vg_lun_5-emc_lv_nas_var_emcsupport
552M 457M 67M 88% /nbsnas/var/emcsupport
anything above 90% will start generating alerts in Unisphere so if you keep this directory below that value you are good.
flya750
24 Posts
0
January 3rd, 2013 22:00
That was easy... Thanks!
r1214
1 Rookie
•
38 Posts
0
February 25th, 2013 10:00
Not that it's hard to do manually of course, but why don't these support files get cleared automatically? I'm tempted to just write a script to remove files in that folder that are older than X days and set the script to run nightly or weekly in root's crontab. Any reason that would be a bad idea?
r1214
1 Rookie
•
38 Posts
0
February 25th, 2013 11:00
Heh, well since you already had the same idea as me and already did the work, let's see what you set to run
dynamox
9 Legend
•
20.4K Posts
0
February 25th, 2013 11:00
i think it's either bash or perl ..will post it tonight.
dynamox
9 Legend
•
20.4K Posts
0
February 25th, 2013 11:00
good question, i do have a cron job that clears all but one month worth of files
r1214
1 Rookie
•
38 Posts
0
February 25th, 2013 12:00
Thanks! I found a one-liner command using find and rm from a Google search that should work, but since I haven't tested it, I'll not post it here and wait to see what you've been using. Do you put yours in root's cron, or someone elses like nasadmin?
dynamox
9 Legend
•
20.4K Posts
0
February 26th, 2013 11:00
uncomment unlink when you are happy with what files it will delete. If the example below i always want to keep 14 days worth of support files.
r1214
1 Rookie
•
38 Posts
0
February 27th, 2013 06:00
I got several syntax errors on your script so I just ended up using this simple one-liner:
find /nbsnas/var/emcsupport -type f -mtime +30 | xargs rm
(where +30 is any files older than 30 days)
So did you run your script under root's cron, or nasadmin's? Does it matter? Also, do user-added cron jobs go away when you perform a software upgrade?
dynamox
9 Legend
•
20.4K Posts
0
February 27th, 2013 07:00
as long as nasadmin has permissions to delete those files, you can put it in nasadmin crontab. Yes, your scripts might get canned whey ControlStation gets upgraded. Some CEs are nice and back it up for you and then put it back.
r1214
1 Rookie
•
38 Posts
3
February 27th, 2013 07:00
Thanks for the help. To anyone reading this with no experience with cron, it's just a unix schedular. You can access it by using
crontab -e
Which will launch the VI text editor and a blank file (since there is no existing scheduled jobs). VI, if you've never used it, is not the most user friendly text editor. Type "i" to begin typing your text, then enter
00 23 * * * find /nbsnas/var/emcsupport -type f -mtime +30 | xargs rm
This will set the command to run it's check at 11:00pm every day. You can Google cron or crontab to read more about how to customize run times.
Finally, to save and exit VI- hit the escape key, then a colon ":", and enter "x", to which it will reply that it installed the new crontab.
dynamox
9 Legend
•
20.4K Posts
0
March 1st, 2013 13:00
script works fine, might need to run dos2unix once you have saved it on the control station.
lavaibm
3 Posts
0
September 23rd, 2016 23:00
Hi dynamox
here used% was 46 only but still i am getting dskMon error daily, can you suggest any other way..
thanks
dynamox
9 Legend
•
20.4K Posts
0
September 24th, 2016 10:00
what is the description of the alert, can you post a picture/text ?
lavaibm
3 Posts
0
September 26th, 2016 03:00
here is the message it shows