-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

,--[ On Fri, Apr 25, 2008 at 10:21:31PM +0530, devesh wrote:
| hi guys,
| 
| Can anyone find something interesting ?
| 
| Well here is a shell script (kill.sh) :
| 
|   *#!/bin/bash
| id=`ps -ef | grep wget | grep -v grep | cut -c 10-15`
| if [ $id -eq 20698 ]

^^^ you should've wrapped $id in quotes, e.g. if [ "$id" -eq 20698 ]

| then
| sleep 10m
| sh kills.sh

^^^ a) name of your script, you mentioned on top is kill.sh
    b) you should've used 'exec sh kill.sh' instead otherwise you'll
end up with a hundreds of 'kill.sh' instances.

| else
| date > kill_time
| poweroff
| fi
| 
| *
| 1.It was around 4.AM i run it background.And checked the PID of wget, it was
| 20698.
| 2.I slept and wake up at 8.40 AM and checked again.
| 3.PC was still ON. No kill.sh was running .No Wget process was running as
| wget-log showed saved at 8.15AM.
| 
| question : why didn't pc go OFF.
| 
| 4.Again I start : sh kill.sh ... PC went OFF. (of course it must be)

If in the first run of script, result of evaluatino false, then it'll get 
executed,
but not for subsequent times, because name of script is incorrect.

| 
| 5. ???? Any comment(s)

HTH
- -- 
Ashish Shukla आशीष शुक्ल                      http://wahjava.wordpress.com/
·-- ·- ···· ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIEhpnHy+EEHYuXnQRAlfdAKCStoBvmphzsh0V46JjrBFroBXQFACgugW5
xpjtnNc1meXPE7pNZAP5GTQ=
=7eC6
-----END PGP SIGNATURE-----

_______________________________________________
ilugd mailinglist -- ilugd@lists.linux-delhi.org
http://frodo.hserus.net/mailman/listinfo/ilugd
Next Event: http://freed.in - February 22-24, 2008
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi 
http://www.mail-archive.com/ilugd@lists.linux-delhi.org/

Reply via email to