Page 1 of 1
init script
Posted: Thu Apr 23, 2009 4:28 pm
by Doom
Hi Eric,
I'm trying to run a script at startup without luck

I've put it in the /etc/init.d/ directory, then changed attribute using chmod 755
According to Kamikaze documentation, next step should be to enable it in this way :
/etc/init.d/
filename enable
This should create a script file into /etc/rc.d/ but unfortunately I've got this error :
root@OpenWrt:/# chmod 755 /etc/init.d/filename
root@OpenWrt:/# /etc/init.d/filename
/bin/sh: can't open /etc/rc.common
Is there any particularity using Gargoyle to create init script ?
Thank you.
Regards
Re: init script
Posted: Thu Apr 23, 2009 5:28 pm
by Eric
The init scripts in Gargoyle have exactly the same structure as in OpenWrt. I suspect the problem is something within your script -- can you post the script itself?
If what you want to do is simple you can just edit the /etc/init.d/done script, which runs right after everything is initialized. Edit the start() function in that script and add on whatever you want to do.
Re: init script
Posted: Sat Apr 25, 2009 12:14 pm
by Doom
Sorry, you're right, some mistakes in my script
All is perfect now
Thank you.
Regards
Re: init script
Posted: Sat Oct 08, 2011 3:40 pm
by pier4r
Sorry for the gravedigging, but the search route me here.
I have the exact problem but i didn't find a solution.
For example i try to run (only run) a simple script:
Code: Select all
#!/bin/sh /etc/rc.common
echo culo
the result is
Code: Select all
root@741nd:/etc/init.d# chmod 755 scriptName
root@741nd:/etc/init.d# ./scriptName
'bin/sh: can't open '/etc/rc.common
(same, obviously, for the longer script that i would like to put as startup script)
Can anyone help me?
info: gargoyle 1.4.0 r27980 from here
http://wiki.openwrt.org/toh/tp-link/tl-wr741nd
Re: init script
Posted: Sat Oct 08, 2011 6:12 pm
by pier4r
fun fact, if i use a direct call to busybox it works (at least the run part)
Code: Select all
root@741nd:/etc/init.d# ls -l z_prova*
-rwxr-xr-x 1 root root 37 Oct 8 21:30 z_prova_02.txt
root@741nd:/etc/init.d# /bin/ash z_prova_02.txt
culo
root@741nd:/etc/init.d# /bin/sh z_prova_02.txt
culo
but with the standard method...
Code: Select all
root@741nd:/etc/init.d# ./z_prova_02.txt
'bin/sh: can't open '/etc/rc.common
Weird.
Re: init script
Posted: Sat Oct 08, 2011 6:33 pm
by pier4r
OMFG i have wasted an entire afternoon.
SOLUTION: use line endings encode linefeed (unix) and not windows one.