Page 1 of 2

How run an ownmade script at boot

Posted: Sun Sep 20, 2015 1:19 pm
by 3iOnDo
Hi all,
i've made a stupid script for clean .log file created by oscam.
If i run it via terminal, it works, but i've put a file in /mnt/etc/init.d/99_99_clean.init

#!/bin/sh
. /mnt/opt/privateer/usr/bin/oscam/clean


and won't work.

Permissions are right

Probably i don't get an obvious thing (i'm not a programmer, i'm just trying to learn how scripts work and how use 'em)

Can you give me a help ?

Re: How run an ownmade script at boot

Posted: Sun Sep 20, 2015 1:34 pm
by juusso
Pay attention to script structure and arguments. Check other scripts and get selfinformed...

case $1 in
start)
Your code here
;;

esac

Re: How run an ownmade script at boot

Posted: Sun Sep 20, 2015 1:38 pm
by 3iOnDo
Thank juusso for reply

So

#!/bin/sh

case $1 in
start)
. /mnt/opt/privateer/usr/bin/oscam/clean
;;

esac


Also is there a wiki about init priority (01_01 will be execute before 99_99 ?) ?
Because i need to delete log before oscam starts.
I remember that i saw something about it, but i think it was a talk in a thread and not a thread ...

Thank you so much

Re: How run an ownmade script at boot

Posted: Sun Sep 20, 2015 2:44 pm
by zoelechat
Hex edit libOscam.so and change /dtv/libOscam.log to /dev/null
No more log :)

Re: How run an ownmade script at boot

Posted: Sun Sep 20, 2015 3:04 pm
by 3iOnDo
Thanks zoe, :D

but i'm trying to launch a script from init.d

just to try

that's why i haven't use your solution yet

clear a log file script it's easy to do for my (un)knowledge.

Via terminal works, but i can't do it on boot.

last try is

Code: Select all

#!/bin/sh

 . /dtv/SGO.env

case $1 in 
	start)
	/mnt/opt/privateer/usr/bin/oscam/clean
        ;;

esac
[/b]

Is it so hard to achieve ?

Re: How run an ownmade script at boot

Posted: Sun Sep 20, 2015 3:10 pm
by zoelechat
Are you using Notepad++ with linefeeds set to Unix Format (LF)? :)

Re: How run an ownmade script at boot

Posted: Sun Sep 20, 2015 3:15 pm
by 3iOnDo
zoelechat wrote:Are you using Notepad++ with linefeeds set to Unix Format (LF)? :)
No, Text Edit with make plain text option (osx).

Usually it works when edited some samyscripts (i've modded "oscam started" in "oscaaaaam" and worked).

Is it in correct form ? Should it works ?

i can try notepad++ if it can be the problem.

Re: How run an ownmade script at boot

Posted: Sun Sep 20, 2015 3:20 pm
by zoelechat
It depends, if you edit an existing script it will keep its linefeed type, but if you start one from scratch it might be different/wrong default...
Just to be sure you can launch your startup script manually and give output:

Code: Select all

sh -x /mnt/etc/init.d/99_99_clean.init start

Re: How run an ownmade script at boot

Posted: Sun Sep 20, 2015 3:25 pm
by 3iOnDo
SpoilerShow
VDLinux#> sh -x /mnt/etc/init.d/99_99_clean.init start
+ . /dtv/SGO.env
+ SYSROOT=/mnt
+ MOUNT_PATH=/dtv/usb/sdb
+ export USER_FIRMWARE=MST12
+ export KMOD_VER=0116
+ export MOD_DIR=/mnt/lib/modules/3.0.33
+ export TMPDIR=/dtv
+ export HOME=/mtd_rwcommon
+ export SMB_CONF_PATH=/mnt/etc/samba/smb.conf
+ LOGFILE=/mnt/samygo.log
+ LD_LIBRARY_PATH=/mnt/opt/privateer/lib:/mnt/opt/privateer/usr/lib:/mnt/lib:/mnt/usr/lib:/tmp/bin:/mtd_cmmlib/RECOGNITION_LIB:/lib:/mtd_cmmlib/lib:/mtd_cmmlib/Comp_LIB:/mtd_exe/lib:/mtd_cmmlib/YWidget_LIB:/mtd_cmmlib/InfoLink/lib/plugin/Static:/mtd_appdata/moip:/mtd_cmmlib/GAME_LIB:/mtd_appdata/gemstar:/mtd_cmmlib/DRM_LIB:/Java/lib:/mtd_cmmlib/InfoLink/lib:/mtd_appext/WidgetEngine:/mtd_appext/Webkit:/mtd_exe/WebServerApp/bin:/mtd_cmmlib/CBRE:/mtd_cmmlib/CBRE/bin/lib:/mtd_cmmlib/flashplayer/libs:/mtd_appdata/Runtime/lib/CairoShadow:/mtd_appdata/Runtime/lib:/mtd_appdata/Runtime/XorgLibs:/mtd_cmmlib/CM_LIB:/mtd_appext/OIPF/lib:/mtd_exe/OIPF/lib:/mtd_contents:/dtv
+ PATH=/mnt/opt/privateer/sbin:/mnt/opt/privateer/bin:/mnt/opt/privateer/usr/bin:/mnt/opt/privateer/usr/sbin:/mnt/sbin:/mnt/bin:/mnt/usr/bin:/mnt/usr/sbin:/tmp/bin:/usr/sbin:/usr/bin:/bin:/sbin:/etc/Scripts:/util:/mtd_appdata/Runtime/bin
+ export ENV=/dtv/.ashrc
+ export FRAMEBUFFER=/dev/sam/fb0
+ export DISTROOT=/mnt/opt/privateer
+ export LIBSO_DIR=/mnt/opt/privateer/usr/libso
+ export TERM=linux
+ export LS_OPTIONS=--color=auto
+ export TZ=GMT-2
+ /mnt/opt/privateer/usr/bin/oscam/clean

Re: How run an ownmade script at boot

Posted: Sun Sep 20, 2015 3:30 pm
by zoelechat
Seems good, problem must be with /mnt/opt/privateer/usr/bin/oscam/clean then :)
Are you sure of permissions? (the ones of /mnt/etc/init.d/99_99_clean.init I mean)