![]() |
#1 |
root
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 26
Karma: 29272
Join Date: Jul 2013
Location: ntldll.dll
Device: Kindle Paperwhite
|
Best way to exec script on boot
If you want to execute a script on boot, use /etc/upstart. The following methods will NOT work:
Make a file with the extension '.conf' and add a start condition and a stop condition as your first and second lines. Be sure your script and your .conf are unix format and not windows. (CRLF is bad and will make big problems.) For example: /etc/upstart/fubar.conf Code:
start on started lab126_gui # This line tells init.d where in the boot process to start this script. Good # places are "start on started framework" if you need it to run after the # framework daemon is running. "start on started lab126_gui" tells it to run # after the ui is up. That is the final phase of the boot process. stop on stopping lab126_gui # This tells the system when in the shutdown process to kill your script. If # you are just running a single command, this isn't terribly important. script # exec /bin/sh /your/script/here.sh exec /bin/bash /var/local/dev/somescript.sh end script If you choose to remove whatever this conf points to, you MUST MUST MUST delete this from the upstart folder. If anything in this folder errors out there is a very good chance your kindle will fail to boot! Original question: Spoiler:
Last edited by knauck; 08-28-2013 at 12:04 PM. |
![]() |
![]() |
![]() |
#2 |
root
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 26
Karma: 29272
Join Date: Jul 2013
Location: ntldll.dll
Device: Kindle Paperwhite
|
Solved own problem. Updated OP to show solution for posterity.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
A variation on this problem solution which puts the scripts into user accessable storage published by dos1 about 5 months ago:
https://www.mobileread.com/forums/sho...d.php?t=198484 Also indexed under the K5 prefix. |
![]() |
![]() |
![]() |
#4 |
BLAM!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,501
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
Wrapping up everything in tests is a good way to avoid everything blowing up if something's missing/wrong/broken.
(For debugging purposes (of the inlined parts of the script), testing your scripts with a shell in -e mode is also a good practice, especially if you rely on external tools with broken return codes). Cf. dos1's tool for more examples, or the upstart jobs of the SS/Fonts hacks). Last edited by NiLuJe; 08-30-2013 at 06:27 PM. |
![]() |
![]() |
![]() |
#5 | |
root
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 26
Karma: 29272
Join Date: Jul 2013
Location: ntldll.dll
Device: Kindle Paperwhite
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45
Karma: 6672
Join Date: Apr 2011
Device: kindle
|
How can I go about it on the k3?
|
![]() |
![]() |
![]() |
#7 |
BLAM!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,501
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
@damaru: A classic SYSV init script
![]() Lemme dig up the interesting runlevels, but, OTOH, 5 is boot, 6 is reboot, 0 is shutdown, and 3 is update. For example, the same script I linked to earlier, but in its K3 version: ScreenSavers hack. (Check the install script for more details on the whole symlinking into the right runlevel stuff). Last edited by NiLuJe; 08-30-2013 at 06:31 PM. |
![]() |
![]() |
![]() |
#9 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45
Karma: 6672
Join Date: Apr 2011
Device: kindle
|
|
![]() |
![]() |
![]() |
#10 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45
Karma: 6672
Join Date: Apr 2011
Device: kindle
|
Expanding on the init script - is it possible to disable the screensaver from that script?
would lipc-set-prop com.lab126.powerd -i touchScreenSaverTimeout 1 work on k3? Last edited by damaru; 08-31-2013 at 01:31 PM. |
![]() |
![]() |
![]() |
#11 |
BLAM!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,501
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
Nope, that doesn't disable screensavers, not at home right now, check the lipc-probe output for powerd. Once you have the right prop, just make sure your script starts after powerd, and you should be okay
![]() |
![]() |
![]() |
![]() |
#12 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Disable screensaver:
lipc-set-prop com.lab126.powerd preventScreenSaver 1 Enable screensaver: lipc-set-prop com.lab126.powerd preventScreenSaver 0 |
![]() |
![]() |
![]() |
#13 |
THE NOOB
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 701
Karma: 1545649
Join Date: Jan 2012
Location: Italy
Device: Kindle Touch 5.3.2
|
|
![]() |
![]() |
![]() |
#14 |
BLAM!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,501
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
@silver18: Upstart runs its script portions more or less like a shell in 'honor return codes' (-e) mode. Meaning if *any* part of the script returns a non-zero return code, the full script/job will fail. Which might possibly halts the boot process, I'm not familiar enough with upstart and the job tree on the Kindle to be definitive on that, and I don't really want to be, so I just handle it with a touch of paranoia
![]() In the OP's examples, that means that if the file it tries to run doesn't exist, it'll fail to start the job, possibly not very gracefully, possibly halting the boot process. So, simple workaround, check that the file exists before running it, (and eventually return 0 at the end for extra paranoia ^^): Code:
exec /bin/bash /var/local/dev/somescript.sh Code:
[ -f /var/local/dev/somescript.sh ] && exec /bin/bash /var/local/dev/somescript.sh |
![]() |
![]() |
![]() |
#15 |
Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45
Karma: 6672
Join Date: Apr 2011
Device: kindle
|
That got resolve over IRC
![]() continuing on launching a script on boot on k3, I would need a tad of help on it, I've createa a /etc/init.d/myscript file that launch the script in /mnt/us/documents/ both script are chmod +x and the script in the /mnt/us/documents works no problem when launched by itself then I should add a soft link in the rc5.d but I am not too sure how to call it? like it should be S but then the number could be anything higher than what is there already? and I should also ln -s for the rc0 for when it stops? Am I making thing way too complexe here? (or making any sense at all) Last edited by damaru; 09-24-2013 at 07:05 PM. Reason: resolved |
![]() |
![]() |
![]() |
Tags |
kindle modifications |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Ant Exec(scp) on Windows Os ? | CapitainDerya | Kindle Developer's Corner | 5 | 08-19-2013 03:37 PM |
How to show kernel boot information instead Amazon boot picture? | madtrapper | Kindle Developer's Corner | 8 | 01-04-2013 08:51 AM |
Story HD Mod: SHD Exec | Wermesz | iRiver Story | 8 | 10-09-2012 01:12 PM |
Opus cannot boot, stuck on boot screen | baloma | Bookeen | 35 | 11-13-2010 04:20 AM |
Best Ereader software for O2 xda exec | rajendra8 | Reading and Management | 2 | 09-10-2009 05:40 AM |