Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Automatic Shutdown

Name: Anonymous 2008-04-26 6:53

I need to find a way to shut down my Linux PC (Ubuntu 8.04 Server) after it has up & downloaded 100MB.
Anyone has any idea on how to do this?

Name: Anonymous 2008-04-26 6:57

Anyone has any idea on how to do this?
Yep.

Name: Anonymous 2008-04-26 7:02

Could you also please explain how -_-'

Name: Anonymous 2008-04-26 7:03

Using COMPUTER SCIENCE

Name: Anonymous 2008-04-26 7:26

#!/bin/bash
RX=`ifconfig | grep -A 6 eth1 | grep "RX bytes" | sed -e "s/\s*RX bytes:\([0-9]*\).*/\1/g"`
TX=`ifconfig | grep -A 6 eth1 | grep "TX bytes" | sed -e "s/.*TX bytes:\([0-9]*\).*/\1/g"`
if [ $RX -ge 104857600 -o $TX -ge 104857600 ]
then
    init 0
fi



Put it in root's crontab.

Name: Anonymous 2008-04-26 7:28

(if (> (+ upload-total download-total) (* 100 1024 1024)) (shutdown))

Name: Anonymous 2008-04-26 7:33

>>5 DON'T HELP HIM!!!

Name: Anonymous 2008-04-26 10:03

>>5
Watch the faggot not get it right because his interface is called something other than eth1.

Name: Anonymous 2008-04-26 10:08

>>8
That was my intention. Now you've warned him.

Name: Anonymous 2008-04-26 10:29

>>5
init 0 Doesn't work on all Unices.
Use shutdown -h now.

Name: Anonymous 2008-04-26 10:35

>>10
Ok, thanks.

However if that's the case on a particular system, chances are that the output of ifconfig is also quite different, which breaks the grep/sed stuff as well.

Name: Anonymous 2008-04-26 10:37

Holy fuck Ubanto 8.04 is out!!

Name: Anonymous 2008-04-26 13:19

You can always hire few niggers instead, if >>5's advice doesn't help.

Name: Anonymous 2008-04-26 13:40

Use haxmyanus now

Name: HAX MY ANUS MEME FAN 2008-04-27 21:03

>>14
I like your style.

Name: Anonymous 2008-04-27 22:53

>>10
s/-h/-p/

Name: Anonymous 2008-04-29 12:15

>>5
Ok, this doesn't work (and yes,I changed it to my eth)

Name: Anonymous 2008-04-29 19:11

>>17
LOL!!!!!!!1

Name: Anonymous 2008-04-29 19:23

EMACS question: how the hell do I set faces? Say I've been provided with a hl-line-face, how to set it to "red"? (setq 'hl-line-face "red") gives me a type error.

Name: Anonymous 2008-04-29 19:50

>>19
You may prefer to start a new thread in /pr/

Name: Anonymous 2008-04-29 19:55

>>20
No, I'd rather not.

Name: Anonymous 2008-04-29 20:18

>>21
Then sage

Name: Anonymous 2008-04-29 21:06

The cancer is now terminal.

Name: Anonymous 2008-04-29 23:59

>>19
You (set-face-foreground 'hl-line-face "red").

Name: Anonymous 2008-04-30 6:27

>>24
I love you bampu pantsu

Name: Anonymous 2008-04-30 9:18

bampu pantsu

Name: Anonymous 2008-04-30 14:26

>>17
This was not meant as a working script for you to kopipe but rather an idea how to do it and some hints on how to build your own script.

Name: Anonymous 2008-05-01 6:07

Ok, I currently have this:

#!/bin/bash
RX=`ifconfig eth0 | grep "RX bytes" | sed -e "s/\s*RX bytes:\([0-9]*\).*/\1/g"`
TX=`ifconfig eth0 | grep "TX bytes" | sed -e "s/.*TX bytes:\([0-9]*\).*/\1/g"`
echo $RX
echo $TX

When I try this:
Total=$RX+$TX
echo $Total

It gives me this error:
: command not found4: [Here is the $RX]

So I need to change the variable to an integer, can someone please tell me how to do this?

Name: Anonymous 2008-05-01 8:24

>>28
/prog/ is not your personal search engine
look around for one of the FIVE MILLION tutorials on shell scripting

Name: Anonymous 2008-05-01 11:10

DON'T HELP HIM!

Name: Anonymous 2008-05-01 11:32

>>30
5 here. Alright. I was tempted but this is getting ridiculous.

Name: Anonymous 2008-05-01 12:43

>>28
Total=$((RX + TX))

Name: Anonymous 2008-05-01 13:29

wget -r something && shutdown -h now

Name: Anonymous 2008-05-01 20:50

>>33
What if the download fails?

Name: Anonymous 2008-05-01 21:01

>>34
Then don't shut down. Duh.

Name: Anonymous 2008-05-02 6:58

#!/bin/bash
RX=`ifconfig eth0 | grep "RX bytes" | sed -e "s/\s*RX bytes:\([0-9]*\).*/\1/g"`
TX=`ifconfig eth0 | grep "TX bytes" | sed -e "s/.*TX bytes:\([0-9]*\).*/\1/g"`
echo RX: $RX
echo TX: $TX
Total=$(($RX + $TX))
echo Total: $Total

Gives me as output:

RX: 42507
TX: 51532
") 51532 error: invalid arithmetic operator (error token is "
Total:

>>33
Thanks for trying to help, but it's not exactly what I need :)

Name: Anonymous 2008-05-02 7:03

>>36
Try removing the invalid arithmetic operators.

Name: Anonymous 2008-05-02 7:05

>>36
/bin/bash --version please

Name: Anonymous 2008-05-02 7:12

>>38
It states
hax my anus v1.34

Name: Anonymous 2008-05-02 7:13

Works for me, just pasted into terminal. Something's out of date with your system if $((...)) doesn't work for arithmetic.

opteron:~ # RX=`ifconfig eth0 | grep "RX bytes" | sed -e "s/\s*RX bytes:\([0-9]*\).*/\1/g"`
opteron:~ # TX=`ifconfig eth0 | grep "TX bytes" | sed -e "s/.*TX bytes:\([0-9]*\).*/\1/g"`
opteron:~ # echo RX: $RX
RX: 35568898031
opteron:~ # echo TX: $TX
TX: 32304412269
opteron:~ # Total=$(($RX + $TX))
opteron:~ # echo Total: $Total
Total: 67873310300

Name: Anonymous 2008-05-02 7:18

>>36
Now that I think about it, it make be putting a double quotes on your RX and TX variables. This may not show up when calling echo since it removes double quotes. However, $((...)) probably can't deal with quoted numbers.

Change
echo RX: $RX
to
set | grep RX
and similarly for TX, then tell us the output.

Name: Anonymous 2008-05-02 7:19

>>39
You're that irritating wanker who turns up to a party and pisses everyone off by being obnoxious, but doesn't take the hint about leaving.

Name: Anonymous 2008-05-02 7:43

>>38
GNU bash, version 3.2.33(1)-release (i486-pc-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.

Name: Anonymous 2008-05-02 7:45

When I paste in my terminal it works

>>38
GNU bash, version 3.2.33(1)-release (i486-pc-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.

Name: Anonymous 2008-05-02 7:45

>>43
Hmm, that should work then.

Try just typing echo $((1234+103)) in your bash shell.

Name: Anonymous 2008-05-02 11:33

>>45
echo $((1234+103))
1337

This is really weird

Name: Anonymous 2008-05-02 12:38

$((RX + TX))
No $'s needed.

Name: Anonymous 2008-05-02 16:14

>>46
...you're joking.

Name: Anonymous 2008-05-02 16:16

RX=`ifconfig eth0 | grep "RX bytes" | sed -e's/\s*RX bytes:\([0-9]*\).*/\1/g'`
TX=`ifconfig eth0 | grep "TX bytes" | sed -e
's/.*TX bytes:\([0-9]*\).*/\1/g'`

Name: Anonymous 2008-05-02 16:41

When I was a kid, I contrived an ingenious contraption with Lego TECHNIC. Using the basic motor, it converted the rotation into repeated up and down thrust that was applied to the `A' button on the Game Boy ADVANCE, which happened to be bound to the procedure swing-whip in the Castlevania game. Making use of my bogus ploy, I could banish multitudes of undead every night and earn experience with little or none effort.

Anyway, OP, I suggest doing something like that.

Name: Anonymous 2008-05-02 16:58

>>50
I lol'd, actually out loud

Name: Anonymous 2008-05-02 17:00

>>51
You laughed out loud actually out loud?

Astounding.

back to /b/, please.

Name: Anonymous 2008-05-02 17:09

>>52
No, no, no.
He laugh out loud'd, actually out loud.
learn2acronymexpansion

Name: Anonymous 2008-05-02 17:10

>>53
LOL Out Loud.

Name: Anonymous 2008-05-02 17:12

>>53
Substitution model considered harmful

Name: Anonymous 2008-05-02 17:19

>>55
Clearly, you haven't seen the 5a SICP video.

While we're at it, please take a look at this:

http://img168.imageshack.us/img168/783/shot2vr4.png

Name: Anonymous 2008-05-02 18:08

For fuck's sake, OP.

If you can't get my solution to work then try something else. Google, read, try. What the fuck.

Name: Anonymous 2008-05-02 19:09

>>57
ubanto

Name: Anonymous 2008-05-02 19:53

>>54
Lolling online.

Name: Anonymous 2008-05-02 20:02

Ubanto is hot *grabs dick*

Name: Anonymous 2008-05-02 20:09

>>60
If you pay me enough I'll give you access to a private area

Name: Anonymous 2008-05-02 20:54

>>61
meme butcher

Name: Anonymous 2008-05-02 23:19

>>61

Hello OP

Name: Anonymous 2008-05-03 2:00

>>62
I couldn't be bothered to jewgle for the standard spelling.  Perhaps if prog.git were endowed with an index of approved meme usage, this wouldn't have happened.

Name: Anonymous 2009-02-25 7:33


The resulting 0 humility   believe believers will   ascend upon the   heavens increase your   registry There is   no use for   a statically typed   language to have   any valuable input   Not so apparently   Factor is the   ffmpeg project which   provides a great   reputation for helping   out newbie hackers?

Name: Anonymous 2011-02-04 16:44

<

Name: Sgt.Kabukiman䖉 2012-05-22 23:26

All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List