sleeper and rebooter

Oguz Yarimtepe comp.ogz at gmail.com
Thu Sep 18 14:59:12 UTC 2008


Hi,

Sorry for late replying. The problem about the script is, there is
nothing that will wake the pc from sleep up. I found rtcwake but
couldn`t run it under Ubuntu. So i need a system to go to sleep and wake
from it automatically.  

On Wed, 2008-08-13 at 10:39 +0200, Florian Diesch wrote:
> #!/bin/sh
> 
> ## Directory to store our files
> DATA_DIR=/you/need/to/change/this
> 
> ## Logging goes here 
> LOGFILE="$DATA_DIR/nrun.log"
> 
> ## The counter is saved here
> COUNTERFILE="$DATA_DIR/nrun.counter"
> 
> ## Command to run
> CMD=gnome-power-cmd.sh suspend
> 
> 
> help(){
>  echo "Usage:"
>  echo "  $0 N"
>  exit 1
>  }
> 
> if [ $# -lt 1 ]; then
>  help
> fi
> 
> N="$1"
> 
> if [ -f "$COUNTERFILE" ]; then
>  COUNT="$(cat "$COUNTERFILE")"
> else
>  COUNT=0
>  echo >  "$LOGFILE"   # start new logfile
> fi
> 
> COUNT="$((COUNT+1))"
> 
> if [ "$COUNT" -gt "$N" ]; then
>  echo > "$COUNTERFILE"
>  exit 0
> fi
> 
> echo "$CMD: $COUNT of $N at $(date)" >> $LOGFILE
> 
> echo "$COUNT" >  "$COUNTERFILE"
> 
> $CMD





More information about the ubuntu-users mailing list