Hi again,
I was thinking about how I could modify
onlinescreensaver so that it will not update automatically whithin a specified timeframe. My goal is to save battery during nighttime, 'cause my update cycle is set to 5 Minutes and I do not need it while I am sleeping.
I now have thought about 2 different approaches to that:
1. modifying onlinescreensaver itself
a) specify two veriables in config.sh
Code:
# Timeframe within which update is disabled, define same time to always update
SLEEPBEGIN=2300 # no update after 23:00
SLEEPEND=0730 # and before 7:00
b) insert the following code in update.sh (before loading utils.sh)
Code:
# do nothing if in sleep timeframe
HOUR=$(date +%H%M)
if [ \( $SLEEPBEGIN -gt $SLEEPEND -a \( $HOUR -ge $SLEEPBEGIN -o $HOUR -le $SLEEPEND \) \) -o \
\( $SLEEPBEGIN -lt $SLEEPEND -a \( $HOUR -ge $SLEEPBEGIN -a $HOUR -le $SLEEPEND \) \) ];
then
exit
fi
this has the disadvantage that even manual updates are blocked
2. creating a cronjob
that calls the enable.sh / disable.sh at specified times.
Code:
00 23 * * * /mnt/us/extensions/onlinescreensaver/bin/disable.sh
00 07 * * * /mnt/us/extensions/onlinescreensaver/bin/enable.sh
This would work for manual updates, but is not very well integrated in onlinescreensaver.
UPDATE: somehow these cronjobs don't work at all. They do not call the script. Hmm...
UPDATE2: works after reboot
3.
Maybe it is possible to let enable.sh create the 2 cronjobs if a timeframe is specified and disable.sh delete these cronjobs. But I don't know how to do that. Maybe like that?
Code:
mntroot rw
echo "00 23 * * * /mnt/us/extensions/onlinescreensaver/bin/disable.sh" >> /etc/crontab/root
echo "00 07 * * * /mnt/us/extensions/onlinescreensaver/bin/enable.sh" >> /etc/crontab/root
mntroot ro
But how do I disable these cronjobs?
And how does onlinescreensaver then know if auto-update is enabled or disabled?!
Any suggestions? I would very much love such a feature!
Hades.