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`
Probably you can active the same using pgrep?
id = `ps -ef | pgrep wget`
> if [ $id -eq 20698 ]
> then
> sleep 10m
> sh kills.sh
> 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)
>
> 5. ???? Any comment(s)
I believe you're running this via cron. So, the user from whose cron
entry you're running it, can issue poweroff command?
Maybe you need to give full path to poweroff?
--
Why can't I ever build character at a Miami condo or a casino somewhere?
-- Calvin
_______________________________________________
ilugd mailinglist -- [email protected]
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/[email protected]/