maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   N900 init.d scripts (https://talk.maemo.org/showthread.php?t=35567)

cddiede 2009-12-01 16:52

N900 init.d scripts
 
So, I'm trying to set the X11vnc server to start automatically when the phone boots by creating a startvnc script in /etc/init.d and then sym-linking that to an /etc/rc3.d/S99vnc entry.

Everything is set up and the startvnc script runs just fine when I invoke it manually with:
"/etc/init.d/startvnc start"

However, when I reboot the phone, no vnc processes are running at boot.

I tried copying the symbolic link to /etc/rc5.d and /etc/rcs.d with no luck.

I even tried creating .login and .autostart files with the vnc start command in my user home directory and got nothing...

Am I missing something about the basic run level physics of a Maemo device?

benny1967 2009-12-01 16:57

Re: N900 init.d scripts
 
I have no N900 and no idea what I'm writing about here ;) - but I have this faint memory that the default runlevel on maemo devices is 2, not 5. Do you see a /etc/rc2.d?

naabi 2009-12-01 17:05

Re: N900 init.d scripts
 
Does the device have file /etc/inittab. It should contain the following line with default runlevel specified.

id:2:initdefault:

Don't have the device and my scratchbox is on different machine, but this is a common way in linux distributions.

cddiede 2009-12-01 17:09

Re: N900 init.d scripts
 
Run level 2, eh?

I hadn't heard that one, but what the hell.

So, I copied the start sym-link to /etc/rc2.d and rebooted.

Still no vnc processes running at boot.

Shanezlar 2009-12-01 17:17

Re: N900 init.d scripts
 
edit: nevermind

qwerty12 2009-12-01 17:19

Re: N900 init.d scripts
 
The N900 uses Upstart, not init.

Make a file in /etc/event.d/.

cddiede 2009-12-01 17:45

Re: N900 init.d scripts
 
Well, I copied the /etc/event.d/welcome script to a vncstart file and replaced it's echo statement with /usr/bin/x11vnc -forever&

Chmod 777 on /etc/event.d/vncstart and rebooted.

Still no vnc processes running at boot.

Am I missing something in the formatting of an event.d script?

cddiede 2009-12-01 17:47

Re: N900 init.d scripts
 
To clarify:

My /etc/event.d/vncstart script looks like this:

Start at startup

script
/usr/bin/x11vnc -forever&
end script

SubCore 2009-12-01 17:50

Re: N900 init.d scripts
 
Quote:

Originally Posted by cddiede (Post 403181)
To clarify:

My /etc/event.d/vncstart script looks like this:

Start at startup

script
/usr/bin/x11vnc -forever&
end script

try
start on startup
(better even "start on X11", since X11vnc needs a running X, although i don't know if X11 is actually exposed as event)

http://upstart.ubuntu.com/getting-started.html

mattmull 2009-12-01 17:51

Re: N900 init.d scripts
 
Does X need to be running before x11vnc is launched?

Edit: SubCore beat me to it :)

hqh 2009-12-01 17:51

Re: N900 init.d scripts
 
You probably need to use "start on started xsession" since vnc requires a running xserver?

cddiede 2009-12-01 18:29

Re: N900 init.d scripts
 
Success!!!

The "start on started xsession" did the trick!

Thanks everyone!

phedders 2009-12-01 20:19

Re: N900 init.d scripts
 
Quote:

Originally Posted by cddiede (Post 403121)
Run level 2, eh?

I hadn't heard that one, but what the hell.

So, I copied the start sym-link to /etc/rc2.d and rebooted.

Still no vnc processes running at boot.

Maemo 5 uses upstart I think (I dont have an N900... yet) so make sure the rc script has the right service comments and then run update-rc.d I think

hopbeat 2009-12-17 20:53

Re: N900 init.d scripts
 
Hello,

I have a problem with event.d.
I have:

Code:

Nokia-N900-42-11:/etc/event.d# cat proximityd
start on started dbus
stop on stopped dbus
respawn

script
        exec /usr/sbin/proximityd
        sleep 5
end script

and

Code:

-rw-r--r--    1 root    root          114 Dec 17 21:42 proximityd
Running
Code:

/usr/sbin/proximityd
from CL works fine. However, app is not started on boot. Any ideas what to do/to check?

b666m 2010-02-20 15:55

Re: N900 init.d scripts
 
hey hopbeat!

did you manage to get the script working on started dbus (or startup or anywhen else)?!

i have nearly the same problem.

it's working from terminal calling with "sh script" but doesn't do anything when called by event.d on startup.
(if it's actually called by event.d ... ://)

hopbeat 2010-02-20 16:54

Re: N900 init.d scripts
 
@b666m, yes, we are using this in proximityd and shortcutd:

Code:

start on XSESSIONS_STARTING
stop on stopped hal
#stop on stopped dbus
respawn
respawn limit 15 3

script

        ## get dbus session bus address
        sleep 2
        PATH="/bin/:/usr/bin"
        pids=`pgrep dbus-daemon`
        for pid in $pids; do
        FILE=`cat /proc/$pid/environ | perl -pe 's/\x0/\n/g'|grep SESSION_BUS_ADDRESS_FILE \
                |sed -e 's/SESSION_BUS_ADDRESS_FILE=//g'`
        done
        eval `cat $FILE`

        export DISPLAY=:0.0
        exec su user -c "exec /usr/sbin/shortcutd"
        sleep 5

end script


laiti 2010-03-18 16:25

Re: N900 init.d scripts
 
Any idea if it would be possible to run a script every time network connection is estabilished? That action doesn’t emit any event.

laiti 2010-03-18 16:35

Re: N900 init.d scripts
 
Quote:

Originally Posted by laiti (Post 572116)
Any idea if it would be possible to run a script every time network connection is estabilished? That action doesn’t emit any event.

Figured it out myself…just put the script to /etc/network/if-up.d. Works!

fhofer 2010-03-30 10:59

Re: N900 init.d scripts
 
Hi guys, do you know what start condition I need to use to launch a script as late as possible during a boot? I would prefer to have the acutal script in MyDocs, so it needs to be mounted at the execution time..
Would start on started xsession do? Or is there something better fitting? Maybe start on started hildon-desktop?

SubCore 2010-03-30 16:29

Re: N900 init.d scripts
 
Quote:

Originally Posted by fhofer (Post 588003)
Hi guys, do you know what start condition I need to use to launch a script as late as possible during a boot? I would prefer to have the acutal script in MyDocs, so it needs to be mounted at the execution time..
Would start on started xsession do? Or is there something better fitting? Maybe start on started hildon-desktop?

i believe the latter (hildon-desktop) is the latest possible event to hook on.
but you won't have any luck placing your scripts on MyDocs, unless you reformat it to ext2/ext3, because VFAT doesn't support the executable flag. just so you know :)

fhofer 2010-03-31 09:09

Re: N900 init.d scripts
 
Quote:

Originally Posted by SubCore (Post 588478)
i believe the latter (hildon-desktop) is the latest possible event to hook on.
but you won't have any luck placing your scripts on MyDocs, unless you reformat it to ext2/ext3, because VFAT doesn't support the executable flag. just so you know :)

Thank you for explaining this. The script in MyDocs really did not work, so I put its contents directly to the init script. The reason why I wanted to have the script in MyDocs was that connecting the phone via USB would cause the script not to be available -- thus I could easily prevent the script execution if there was any trouble..

rambo 2010-03-31 09:27

Re: N900 init.d scripts
 
Quote:

Originally Posted by fhofer (Post 589400)
The reason why I wanted to have the script in MyDocs was that connecting the phone via USB would cause the script not to be available -- thus I could easily prevent the script execution if there was any trouble..

Check if MyDocs is mounted and exit the script if not.

crabsody 2010-07-15 20:40

Re: N900 init.d scripts
 
I have this script in my /etc/event.d

start on started dbus
stop on stopped dbus
respawn

script
exec /usr/sbin/calltimerdaemon
end script


Of course /usr/sbin/calltimerdaemon works nice if called by CL. But when I boot the machine it doesn't work. Any ideas?


All times are GMT. The time now is 05:35.

vBulletin® Version 3.8.8