autoexec.sh not working

All about firmwares for routers. Support for RouterTech firmwares is here too.
Post Reply
willshep
Regular
Regular
Posts: 46
Joined: Tue Mar 27, 2007 1:45 pm

autoexec.sh not working

Post by willshep » Tue May 12, 2009 12:58 pm

Hi - Following is from getenv (missing top stuff) - any ideas why none of these autoexec variants are being triggered? I use a brand new swart2 safecom.

Thanks.

Code: Select all

NVS_TFTP_LOAD   0
HWA_0   00:30:54:C7:09:F4
HWA_3   00:30:54:C7:09:F5
WLAN_HWADDR     00:30:54:C7:09:F6
HWA_HRNDIS      00:30:54:C7:09:F7
configid        0
mtd1    0x90020090,0x900aa000
mtd0    0x900aa000,0x90400000
darkstat_parms  -i ppp0
autoexec.sh     cd /var && wget ftp://will:*@192.168.1.100/addhosts.sh &&chmod a+x ./addhosts.sh && ./addhosts.sh
autoexec1.sh    cd /var && wget ftp://will:*@192.168.1.100/addhosts.sh &&chmod a+x ./addhosts.sh && ./addhosts.sh
RT_cmd_1        cd /var && wget ftp://will:*@192.168.1.100/addhosts.sh &&chmod a+x ./addhosts.sh && ./addhosts.sh
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Tue May 12, 2009 5:20 pm

Have you tried running the commands manually?
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
willshep
Regular
Regular
Posts: 46
Joined: Tue Mar 27, 2007 1:45 pm

Post by willshep » Tue May 12, 2009 5:33 pm

Hi thanks for the reply

Yea I've run them successfully it all works really nicely but for some reason the autoexec doesn't trigger on either software 'reboot' or actual power on/off.

my script just makes some additions to the hosts file.

the router arrived about a month ago and updated it immediately to RT2.9 and it works flawlessly (tbh i didn't even give safecom firmware a chance to breathe) . Only noticed that the startup scripts don't trigger.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Tue May 12, 2009 6:00 pm

I think the "*" in the command lines might be a problem.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
willshep
Regular
Regular
Posts: 46
Joined: Tue Mar 27, 2007 1:45 pm

Post by willshep » Tue May 12, 2009 9:21 pm

Ah sorry i just snipped out my password there! It's normally just text.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Tue May 12, 2009 9:36 pm

Maybe you should try passing another command to autoexec.sh to verify that it "triggers" - e.g.,

Code: Select all

setenv autoexec.sh "date > /var/1.txt && echo It works! >> /var/1.txt"
/sbin/reboot
And after the router reboots, check whether /var/1.txt exists, and contains the things that told autoexec.sh to write to it. If it does, then the autoexec feature works (in which case your problem might be a timing issue or a communication problem with your ftp server).
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
willshep
Regular
Regular
Posts: 46
Joined: Tue Mar 27, 2007 1:45 pm

Post by willshep » Wed May 13, 2009 1:15 pm

Ok so after some tweaking it's working.

I changed the wget command from:

Code: Select all

cd /var && wget http://192.168.1.100:89/addhosts.sh
to:

Code: Select all

wget -O/var/tmp/addhosts.sh http://192.168.1.100:89/addhosts.sh
Forcing an output directory and file.

But I copied your code originally chief where there was a 'cd' at the beginning but on this router, it doesn't seem to work.

Suffice to say though, the autoexec does trigger as normal though.

Will.
[/code]
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Wed May 13, 2009 3:57 pm

I am not sure why the "cd" command should affect anything (perhaps a busybox regression) - but you could make it simpler like this

Code: Select all

wget http://192.168.1.100:89/addhosts.sh -P /var/tmp
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
willshep
Regular
Regular
Posts: 46
Joined: Tue Mar 27, 2007 1:45 pm

Post by willshep » Wed May 13, 2009 4:28 pm

Ahh thats better, tbh i had trouble wading through wgets manual :)

Not sure about cd either. Does your startup script still have a cd in it in version 2.9 and work?

And thanks for the help, really appreicate it and another great f/w release too!
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Wed May 13, 2009 5:24 pm

willshep wrote:Ahh thats better, tbh i had trouble wading through wgets manual :)
Hint: "wget --help"
willshep wrote:Not sure about cd either. Does your startup script still have a cd in it in version 2.9 and work?
Yep - works here.
willshep wrote:And thanks for the help, really appreicate it and another great f/w release too!
:)
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
Post Reply