View Single Post
b666m's Avatar
Posts: 1,090 | Thanked: 476 times | Joined on Jan 2010 @ Ingolstadt, Germany
#31
EDIT: FORGET USING INIT.D ON MAEMO! FOR STARTING YOUR OWN SCRIPTS RUN IT VIA EVENT.D! LOOK DOWN THIS SITE FOR AN EXAMPLE! ;D

QUESTION: ^^

Code:
#! /bin/sh
# /etc/init.d/rvid

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    cd /etc/hildon-welcome.d/dconfs/

    if [ -f 1.conf ]; then

    # determine number of files in /dconfs
    nof=$(ls *.conf | wc -l)

    # get random number
    rna=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")
    rna=$(dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -f1 -d" ")

    if [ $rna -ge $rnb ]; then
    let "rn = $rna - $rnb"
    else
    let "rn = $rnb - $rna"
    fi

    # in range of 1 - nof
    let "rr = $rn % $nof + 1"

    # choose random conf
    rf="$rr.conf"
    echo "$rr.conf"

    # copy it over to default.conf
    cp $rf ../default.conf

    fi 
    ;;
  stop)
    ;;
  *)
    ;;
esac

exit 0
source: http://www.debian-administration.org...me_with_Debian

then doing:
Code:
chmod 755 /etc/init.d/rvid
update-rc.d rvid defaults
is this the correct way for launching my script on bootup? o.O

Last edited by b666m; 2010-02-20 at 06:21.