help me plz with df


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help me plz with df
# 1  
Old 05-25-2008
Java help me plz with df

i try write script for check space disk and if >87% then try find file in /.../mp3/ and delete only 5gb OLD file. i try this

root@des:/media/generaly# nano 1111.sh
Code:
i#!/bin/sh
if [ $(df -h | awk '/dev/sdc1 {if ($5>"86%") {print 1} else {print 0}}') = "1" ];
then
print fuck
fi

root@des3:/media/generaly# . 1111.sh
bash: [: too many arguments
root@des:/media/generaly# sh 1111.sh
[: 6: 0: unexpected operator
root@des:/media/generaly# df -k |awk '/dev/sdc1 {if ($5>"86%") {print 1} else {print 0}}'
1
0
0
0
0
0
0
root@des:/media/generaly#

and perl script
root@des:/media/generaly# nano 1111.pl
Code:
#!/usr/bin/perl
@result = qx{df};
foreach $elem (@result) {
if ($elem =~ /dev\/sdc1.+ (.\d)\%.+/) 
{
if ($1 > 87)
{
print fuck
}

root@des:/media/generaly# . 111.pl
bash: @result: command not found
bash: 111.pl: line 3: syntax error near unexpected token `('
bash: 111.pl: line 3: `foreach $elem (@result) {'

root@des:/media/generaly# ./111.pl
Missing right curly or square bracket at ./111.pl line 9, at end of line
syntax error at ./111.pl line 9, at EOF
Execution of ./111.pl aborted due to compilation errors.
root@des:/media/generaly#

sorry im noob in programming, and dont know what he wonna say me or what i need write to the end file.
:-[
but
root@webmp3:/media/generaly# df -k /dev/sdc1|grep %|awk '{print $5}'|sed 's/%//g'
Use
89
root@webmp3:/media/generaly#

plz help me with this shit :\
os: ubuntu 8.04 x64
# 2  
Old 05-25-2008
this will list all files in your folder, oldest first, newest last.

Code:
find /path/to/your/mp3 -type f -printf "%T@ %p \n" | sort -n -k 1,1 | awk '{print $2}'

you can make your script delete the 100 oldest mp3
and run it again then
# 3  
Old 05-26-2008
Quote:
Originally Posted by scarfake
this will list all files in your folder, oldest first, newest last.

Code:
find /path/to/your/mp3 -type f -printf "%T@ %p \n" | sort -n -k 1,1 | awk '{print $2}'

you can make your script delete the 100 oldest mp3
and run it again then
ohh nice thx)i will try
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

plz help me

hi... i want to print the below format by using shell scripting...plz help me 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 Thanking u in advance... regards ram (1 Reply)
Discussion started by: ram_pl
1 Replies

2. UNIX for Dummies Questions & Answers

PLZ help..!!

plz help me with this question : 1111 | aaaa | pppp | 23/9/87 3333 | dddd | oooo | 6/9/8 4444 | gggg | rrrr | 5/8/9 5555 | qqqq | eeee ans: 5555 | qqqq | eeee depending upon how many "|" are in the question be quick.. (8 Replies)
Discussion started by: adityamitra
8 Replies

3. Shell Programming and Scripting

plz help me

this script reads source.txt and move and random choice 6 files among 25 txt file and renmame it.. but it is not executed.. whats problem? #!/bin/ksh while read line do cd $line/radmin num=0 /bin/ls *.txt | while read file_nm ; do (( check = $RANDOM % 2 )) if ; then continue... (1 Reply)
Discussion started by: topic32428285
1 Replies

4. Solaris

can anyone help plz

hi I have been given a new Sun fire V120 which i had no use for but my firend wished to host a maple story sever on it so i was happy to let him use it but i have run in to the problem that i have no clue how to configure it so he can use it if anyone can help we would realy appreciate it. Am... (1 Reply)
Discussion started by: rdsars
1 Replies

5. Shell Programming and Scripting

Plz help

I am a newbie to Unix, I am using vi editor. I was able to print output to the screen using simple scripts. But when I tried a midlevel script I don't see anything on the screen and Cursor is just blinking when I type ./test11 filename. I have used chmod 755 also, but of no use. Any help would... (3 Replies)
Discussion started by: Mandab
3 Replies

6. UNIX for Dummies Questions & Answers

plz help me

how i can download the game plz tell me ????? ty :) :) :) (3 Replies)
Discussion started by: Sora21
3 Replies

7. Programming

plz help

alright, i just got this assignment. since im very new to unix programming, i would like to have some ideas about it. honestly, i dont even know what the hell he is asking for. plz see the attached pdf and help me out. thank you :( (2 Replies)
Discussion started by: ligerdave
2 Replies

8. Programming

plz help!

i'm pretty new to unix programming. i just wanna know how exactly fork(), waitpid() works. i have read some from the book, but it's still confusing. especially with those < 0 and == 0. plz help!!!! (1 Reply)
Discussion started by: ligerdave
1 Replies

9. UNIX for Dummies Questions & Answers

plz Help How should I configure cc compiler output file plz help???

i.e configuration of C compiler :confused: (4 Replies)
Discussion started by: atiato
4 Replies
Login or Register to Ask a Question