DATA Step, Macro, Functions and more

SAS program to email the space usage of UNIX file system

Reply
Super Contributor
Posts: 435

SAS program to email the space usage of UNIX file system

 

Right now I'm connecting to the UNIX server and submitting the following commands

 

df -g /sasuser

df -g /saswork

df -g /sasuser/network_shared

 

It will give output as follows.

 

Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/sasuserl 1419.00 503.79 65% 48937 1% /sasuser

 

Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/sasworkl 477.00 206.59 57% 3283 1% /saswork

 

Filesystem GB blocks Free %Used Iused %Iused Mounted on
prod_storage:/SasShare 1638.40 451.07 73% 328973 2% /sasuser/network_shared.

 

I used to manually submit the df -g command in each directory as stated above twice (morning and evening) per day to monitor the space usage and then email the same to the team.

 

Appreciate if someone help me with the SAS program to accomplish this task. Thank you!

Trusted Advisor
Posts: 1,566

Re: SAS program to email the space usage of UNIX file system

[ Edited ]

Mainline per librray, eg sasuser:

 

data _null_;

     call system("df -g /sasuser > /home/sasuser_usage.txt"); 

      /* add similar to create any other library result */

run;

filename mymail email "..send_to@..." ;

               

data _NULL_;

      file mymail;

     to = ("email_address1@..." "email_address2@..." ... etc... )

     /* optional */  cc= ("...email ..."  ....)

     subject = "... subhect text ..."

     attach = ("/home/sasuser_usage.txt" "...2nd file..." ...etc... );

     put "... text line 1 ...";

     put "... text line 2 ...";

      ...etc.....

run;

 

    

Ask a Question
Discussion stats
  • 1 reply
  • 151 views
  • 0 likes
  • 2 in conversation