[Xperia Arc Android Development] gerardojerry:
[MENTION=4733114]harsh586[/MENTION] look at this please...

Some values are making script to be stuck at fusion logo for 45 secs(after vibrating)... original script is like this: (some script part removed because it is not necesary for this explanation)

#!/system/bin/sh
#
for n in 1 2
do

USER_LAUNCHER=Launcher2.apk # Change this to your launcher app

NUMBER_OF_CHECKS=0	# Total number of rechecks before ending 1st loop
SLEEP_TIME=0	# Number of seconds between rechecking processes
PROCESSES_TOTAL=14	# Must be edited to match the number of processes to be checked
DEBUG_ECHO=0	# Debug on/off

CHECK_COUNT=0	# Don't edit
P_CHECK=0	# Don't edit
CHECK_OK=0	# Unused

PROCESS_1=0; PROCESS_2=0; PROCESS_3=0; PROCESS_4=0; PROCESS_5=0; PROCESS_6=0;
PROCESS_7=0; PROCESS_8=0; PROCESS_9=0; PROCESS_10=0; PROCESS_11=0; PROCESS_12=0;
PROCESS_13=0; PROCESS_14=0; PROCESS_15=0; PROCESS_16=0; PROCESS_17=0; PROCESS_18=0;
PROCESS_19=0; PROCESS_20=0; PROCESS_21=0; PROCESS_22=0; PROCESS_23=0; PROCESS_24=0;

if [ $n -eq "1" ]; then
if [ $DEBUG_ECHO -eq "1" ]; then
echo ""
echo "LST Debug: $(date)"
echo "LST Debug: Initiate"
fi;

# Pause and then loop until kswapd0 is found, which should be instant anyway
sleep 1
SWAP_SLEEP_TIME=3; SWAP_NUMBER_OF_CHECKS=30; SWAP_CHECK_COUNT=0; SWAP_CHECK_COUNT_OK=0; while [ $SWAP_CHECK_COUNT -lt $SWAP_NUMBER_OF_CHECKS ]; do if [ `pidof kswapd0` ]; then renice 19 `pidof kswapd0`; SWAP_CHECK_COUNT=$SWAP_NUMBER_OF_CHECKS; SWAP_CHECK_COUNT_OK=1; else sleep $SWAP_SLEEP_TIME; fi; SWAP_CHECK_COUNT=`expr $SWAP_CHECK_COUNT + 1`; done; if [ $SWAP_CHECK_COUNT_OK -lt 1 ]; then echo "LST Debug: 'kswapd0' expired after `expr $SWAP_CHECK_COUNT \* $SWAP_SLEEP_TIME` seconds"; fi;

if [ $DEBUG_ECHO -eq "1" ]; then
echo "LST Debug: $(date)";
echo "LST Debug: kswapd0 found";
fi;
fi;

# Check briefly one more time
if [ $n -eq "2" ]; then
if [ $DEBUG_ECHO -eq "1" ]; then
echo "LST Debug: 2nd loop"
fi;
NUMBER_OF_CHECKS=6	# Editing not recommended to all
SLEEP_TIME=5	# Editing not recommended
fi;

while [ $CHECK_COUNT -lt $NUMBER_OF_CHECKS ];
do
[B] {etc. etc. etc.}[/B]
done

if [ $DEBUG_ECHO -eq "1" ]; then
[B]{etc etc etc....}[/B]
echo "LST Debug: Checking complete"
fi;

done

if [ $DEBUG_ECHO -eq "0" ]; then
echo "LST Debug: Done"
echo ""
fi;

Now, if we lower down sleep value and number of checks like this...

#!/system/bin/sh
#
for n in 1 2
do

USER_LAUNCHER=Launcher2.apk # Change this to your launcher app

NUMBER_OF_CHECKS=0	# Total number of rechecks before ending 1st loop
SLEEP_TIME=0	# Number of seconds between rechecking processes
PROCESSES_TOTAL=14	# Must be edited to match the number of processes to be checked
DEBUG_ECHO=0	# Debug on/off

CHECK_COUNT=0	# Don't edit
P_CHECK=0	# Don't edit
CHECK_OK=0	# Unused

PROCESS_1=0; PROCESS_2=0; PROCESS_3=0; PROCESS_4=0; PROCESS_5=0; PROCESS_6=0;
PROCESS_7=0; PROCESS_8=0; PROCESS_9=0; PROCESS_10=0; PROCESS_11=0; PROCESS_12=0;
PROCESS_13=0; PROCESS_14=0; PROCESS_15=0; PROCESS_16=0; PROCESS_17=0; PROCESS_18=0;
PROCESS_19=0; PROCESS_20=0; PROCESS_21=0; PROCESS_22=0; PROCESS_23=0; PROCESS_24=0;

if [ $n -eq "1" ]; then
if [ $DEBUG_ECHO -eq "1" ]; then
echo ""
echo "LST Debug: $(date)"
echo "LST Debug: Initiate"
fi;

# Pause and then loop until kswapd0 is found, which should be instant anyway
sleep 1
[COLOR="Red"] [B]SWAP_SLEEP_TIME=1[/B][/COLOR]; SWAP_NUMBER_OF_CHECKS=30; SWAP_CHECK_COUNT=0; SWAP_CHECK_COUNT_OK=0; while [ $SWAP_CHECK_COUNT -lt $SWAP_NUMBER_OF_CHECKS ]; do if [ `pidof kswapd0` ]; then renice 19 `pidof kswapd0`; SWAP_CHECK_COUNT=$SWAP_NUMBER_OF_CHECKS; SWAP_CHECK_COUNT_OK=1; else sleep $SWAP_SLEEP_TIME; fi; SWAP_CHECK_COUNT=`expr $SWAP_CHECK_COUNT + 1`; done; if [ $SWAP_CHECK_COUNT_OK -lt 1 ]; then echo "LST Debug: 'kswapd0' expired after `expr $SWAP_CHECK_COUNT \* $SWAP_SLEEP_TIME` seconds"; fi;

if [ $DEBUG_ECHO -eq "1" ]; then
echo "LST Debug: $(date)";
echo "LST Debug: kswapd0 found";
fi;
fi;

# Check briefly one more time
if [ $n -eq "2" ]; then
if [ $DEBUG_ECHO -eq "1" ]; then
echo "LST Debug: 2nd loop"
fi;
[B][COLOR="Red"]NUMBER_OF_CHECKS=1[/COLOR][/B]	# Editing not recommended to all
[COLOR="red"][B]SLEEP_TIME=1[/B][/COLOR]	# Editing not recommended [COLOR="DarkRed"](haha why not!)[/COLOR]
fi;

while [ $CHECK_COUNT -lt $NUMBER_OF_CHECKS ];
do
[B]{etc. etc. etc.}[/B]
done

if [ $DEBUG_ECHO -eq "1" ]; then
[B] {etc etc etc...}[/B]
echo "LST Debug: Checking complete"
fi;

done

if [ $DEBUG_ECHO -eq "0" ]; then
echo "LST Debug: Done"
echo ""
fi;

Boot time decreases to 15 secs and script runs OK at boot,

maybe decreasing swap sleep time is not necessary but not sure

Please tell me if you agree with me or if i am wrong :good: