Sponsored Content
Full Discussion: help me plz with df
Top Forums Shell Programming and Scripting help me plz with df Post 302198917 by djdes22 on Sunday 25th of May 2008 06:58:33 AM
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
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
removable-media(9P)					   Kernel Properties for Drivers				       removable-media(9P)

NAME
removable-media - removable media device property DESCRIPTION
A device that supports removable media--such as CDROM, JAZZ, and ZIP drives--and that supports power management and expects automatic mounting of the device via the volume manager should export the boolean (zero length) property removable-media. This property enables the system to make the power state of the device dependent on the power state of the frame buffer and monitor. See the power.conf(4) discussion of the device-dependency-property entry for more information. Devices that behave like removable devices (such as PC ATA cards, where the controller and media both are removed at the same time) should also export this property. EXAMPLES
Example 1: removable-media Entry An example of a removable-media entry from the .conf file of a driver is shown below. # This entry keeps removable media from being powered down unless # the console framebuffer and monitor are powered down # removable-media=1; Example 2: Implementation in attach() Below is an example of how the entry above would be implemented in the attach(9E) function of the driver. xxattach(dev_info_t *dip, ddi_attach_cmd_t cmd) { ... if (ddi_prop_create(DDI_DEV_T_NONE, dip, DDI_PROP_CANSLEEP, "removable-media", NULL, 0)) != DDI_PROP_SUCCESS) goto failed; ... } ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
power.conf(4), pm(7D), attach(9E), detach(9E), ddi_prop_create(9F) Writing Device Drivers SunOS 5.10 15 Jun 2001 removable-media(9P)
All times are GMT -4. The time now is 06:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy