Tiny Core Base > TCB Talk
powering off a TCL computer
cast-fish:
Hello,
do you know any code snippet for TCL that will make the laptop switch OFF
if there is no video movement or mouse/keys interaction.?
For example
1) If there is no movement on the screen or mouse/keys activity for over 5 mins
shut down or hibernate this laptop. (what's the code snipper for that?)
2) Or just a hard command such as "shut down or hibernate this laptop 3 hours from now"
what's the code snippet for that?
thanks
V
Rich:
Hi cast-fish
--- Quote ---2) Or just a hard command such as "shut down or hibernate this laptop 3 hours from now"
what's the code snippet for that?
--- End quote ---
How about:
--- Code: ---#!/bin/sh
#Number of seconds to wait before power off
DELAY=10800
sleep $DELAY
sudo poweroff
--- End code ---
kalu:
From busybox's website, it seems that that their power, reboot and halt commands already have a '-d SEC Delay interval' similar to the shutdown command used in other GNU/Linux systems... I've never tried it though, so I don't know..
There's also a $TMOUT built-in variable that I know of that's in bash which automatically logs the user out after a set period of inactivity from the current terminal. I don't know if something similar exists in ash. But it seems like you need something more for GUI...
cast-fish:
Hello there and thanks for you reply..
Well it seemed to me to be just a scase of "scheduling a task" to do shutdown.
The web contained all the info to use "crontab" task scheduler and which line
of text and command to use......TCL also had it's cron daemon running....but
all of this still didn't work.
Something must have been wrong with my pointing the cron task to the "s2ram"
program. TCL and Cron certainly recognised that i was trying to do something but it
didnt work.
...in theory "crontab" is extremely simple to use so it's a bit
dissheartening to not get that working...
will have a try with your reply....and thanks
V
cast-fish:
Rich,
many thanks to you indeed.
Your shell script for shutdown is working. It is really simple isn't it.
thanks
V
Navigation
[0] Message Index
[#] Next page
Go to full version