|
|
2010-02-21
, 07:44
|
|
|
Posts: 188 |
Thanked: 185 times |
Joined on Dec 2009
@ Finland
|
#112
|
i tried to launch the script on shutdown with "start on shutdown" but this doesn't work.
start on starting shutdown
grep shutdown /etc/event.d/*
|
|
2010-02-21
, 10:49
|
|
Posts: 527 |
Thanked: 121 times |
Joined on Feb 2010
|
#113
|
|
|
2010-02-21
, 16:19
|
|
|
Posts: 1,090 |
Thanked: 476 times |
Joined on Jan 2010
@ Ingolstadt, Germany
|
#114
|
seconds since 00:00:00, Jan 1, 1970 (a GNU extension)
Note that this value is defined by the localtime system
call.
|
|
2010-02-21
, 16:41
|
|
|
Posts: 1,090 |
Thanked: 476 times |
Joined on Jan 2010
@ Ingolstadt, Germany
|
#115
|
start on starting shutdown
script
cd /etc/hildon-welcome.d/dconfs/
if [ -f 1.conf ]; then
# check which file is currently used
if [ -f *.lock ]; then
cuf=$(ls *.lock)
ruf=$cuf
rm *.lock
else
cuf="1.lock"
ruf=$cuf
fi
# determine number of files in /dconfs
nof=$(ls *.conf | wc -l)
while [ "$ruf" = "$cuf" ]; do
# get "random" number lol
rn=$(date +%s)
# in range of 1 - nof
let "rr = $rn % $nof + 1"
# choose random conf
ruf="$rr.lock"
rf="$rr.conf"
done
# set file for checking which file is in use
rb="$rr.lock"
echo "rb $rb - rf $rf"
# copy it over to default.conf
cp $rf ../default.conf
touch $rb
fi
end script

|
|
2010-02-21
, 16:42
|
|
Posts: 527 |
Thanked: 121 times |
Joined on Feb 2010
|
#116
|
|
|
2010-02-21
, 16:45
|
|
|
Posts: 1,090 |
Thanked: 476 times |
Joined on Jan 2010
@ Ingolstadt, Germany
|
#117
|
|
|
2010-02-21
, 16:53
|
|
|
Posts: 1,090 |
Thanked: 476 times |
Joined on Jan 2010
@ Ingolstadt, Germany
|
#118
|
Buddy. where you have updated it?
On page 4 it is stated that the last update was done yesterday
| The Following User Says Thank You to b666m For This Useful Post: | ||
|
|
2010-02-21
, 17:08
|
|
|
Posts: 1,090 |
Thanked: 476 times |
Joined on Jan 2010
@ Ingolstadt, Germany
|
#120
|
it makes a copy (dd) of /dev/urandom but only of the first block (count 1) and deletes the rest (2> /dev/null).
because urandom doesn't only consists of numbers - but we want a number/integer - you have to change this using the checksum (cksum).
but this checksum is way too long so we are cutting (cut) it off. (:
i'm only searching for another way of getting randomness in my script on startup.
i tried it with rn=$(date +%S) which saves only the seconds of the current timestamp in rn... but on startup date-command only counts up and doesn't show the actual time
so i'm only getting 1 and 2... -.-
i've been searching google for the last few hours... but i can't find anything useful...
btw: i'm awake for over 40 hours... my eyes are bloody-red... so i'll go in my bed now ^^
if somebody knows a solution for getting a random number at startup... please post
good night. (: