Active Topics

 


Reply
Thread Tools
Posts: 146 | Thanked: 149 times | Joined on Apr 2010
#1
Hi,

I am struggling now for over 12 hours with a problem of starting my application after the boot.

I have created scripts and saved them in following locations:

/etc/init.d/imhere
/etc/init.d/imhere_run_later

then I have used "ln -s" command to create a link to /etc/init.d/imhere from /etc/rc2.d/S99imhere

Unfortunately my application did not start. I started playing around with those files in init.d and finally ended up with following:

/etc/init.d/imhere:
Code:
#!/bin/sh

echo "IMHERE INIT CALLED" >> /home/user/startuplog

case "$1" in
  start)
    echo "IMHERE INIT START CALLED" >> /home/user/startuplog
    /etc/init.d/imhere_run_later &
	;;
  *)
esac

echo "IMHERE INIT EXITING" >> /home/user/startuplog
exit 0
/etc/init.d/imhere_run_later:
Code:
echo "ENTERED RUN_LATER" >> /home/user/startuplog
sleep 1
echo "SLEPT 1" >> /home/user/startuplog
sleep 1
echo "SLEPT 2" >> /home/user/startuplog
sleep 1
echo "SLEPT 3" >> /home/user/startuplog
sleep 1
echo "SLEPT 4" >> /home/user/startuplog
sleep 1
echo "SLEPT 5" >> /home/user/startuplog
sleep 1
echo "SLEPT 6" >> /home/user/startuplog
sleep 1
echo "SLEPT 7" >> /home/user/startuplog
sleep 1
echo "SLEPT 8" >> /home/user/startuplog
sleep 1
echo "SLEPT 9" >> /home/user/startuplog
sleep 1
echo "SLEPT 10" >> /home/user/startuplog
sleep 10
echo "SLEPT 20" >> /home/user/startuplog
sleep 10
echo "SLEPT 30" >> /home/user/startuplog
sleep 10
echo "SLEPT 40" >> /home/user/startuplog
sleep 10
echo "SLEPT 50" >> /home/user/startuplog
sleep 10
echo "SLEPT 60" >> /home/user/startuplog
sleep 10
echo "SLEPT 70" >> /home/user/startuplog
sleep 10
echo "SLEPT 80" >> /home/user/startuplog
sleep 10
echo "SLEPT 90" >> /home/user/startuplog
sleep 10
echo "SLEPT 100" >> /home/user/startuplog
sleep 10
echo "SLEPT 110" >> /home/user/startuplog
sleep 10
echo "SLEPT 120" >> /home/user/startuplog
sleep 30
echo "SLEPT 150" >> /home/user/startuplog
sleep 30
echo "SLEPT 180" >> /home/user/startuplog
echo "NOT SLEEPING ANYMORE" >> /home/user/startuplog
/usr/bin/imhere &
echo "APP SHOULD BE STARTED BY NOW" >> /home/user/startuplog
exit 0
I created symbolic links for ever /etc/rc?.d/ folder

I have modified also /etc/init.d/hulda by adding at the beggining of the file following piece of code:
Code:
echo "HULDA INIT" >> /home/user/startuplog
After emptying /home/user/startuplog and rebooting my device the file /home/user/startuplog contains only text "HULDA INIT".

If I run myself the script /etc/init.d/imhere from terminal, the startuplog file will fill up with "SLEPT..." and the other echoed text as expected and /usr/bin/imhere starts running.

Question is: Why my own scripts are not called/executed at startup?

Thanks in advance.

Last edited by rachol; 2010-04-15 at 13:02.
 
krk969's Avatar
Posts: 754 | Thanked: 630 times | Joined on Sep 2009 @ London
#2
maemo uses upstart , did you try something like this ?

*EDIT*
more info about upstart => link
__________________
Developer of :
Buddy - budget/expense manager ( website )
Showtime - a telly channel listing viewer/reminder ( website )
Travelapp - london underground status/planner ( website )
Batlevel - desktop widget for battery level ( website )

“I hear and I forget. I see and I remember. I do and I understand.”

Last edited by krk969; 2010-04-15 at 13:29.
 

The Following 3 Users Say Thank You to krk969 For This Useful Post:
Posts: 146 | Thanked: 149 times | Joined on Apr 2010
#3
Thanks, that was a very good advice. Indeed maemo uses upstart.

I have checked the post about batlevel and it helped a lot, finally my script starts at the startup time.

Now, I see I have some other problems also.

I want to start a Qt application and show the window to the user, the problem is, that the application does not want to start(is terminated?), though I have no problems to run it from applications menu or the command line.

I have heard, that I should split my code to 2 applications ( non graphical daemon, and the window app), but I would prefer having only one.

Any ideas?
 
krk969's Avatar
Posts: 754 | Thanked: 630 times | Joined on Sep 2009 @ London
#4
what app is it that you are trying to start ?
how do you start it ?
could you provide more details then somebody or myself could try and help, there isnt much info you have provided ?
__________________
Developer of :
Buddy - budget/expense manager ( website )
Showtime - a telly channel listing viewer/reminder ( website )
Travelapp - london underground status/planner ( website )
Batlevel - desktop widget for battery level ( website )

“I hear and I forget. I see and I remember. I do and I understand.”
 
Posts: 146 | Thanked: 149 times | Joined on Apr 2010
#5
I am developing my own application, that listens to text messages and then executes different kind of actions depending on the text given in the message.

Usually the application runs hidden in the background, but it might be woken up (shown in FullScreen) by certain commands in the text messages.

The application is ready and working if it has been run after the reboot, but it does not want to start during startup.

Here is the main.cpp:
Code:
#include <QApplication>
#include "ConfigurationWizard.h"
#include "BackgroundTask.h"
#include "Settings.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QApplication ::setOverrideCursor(QCursor(Qt::BlankCursor));
    
    Settings settings;
    
    ConfigurationWizard window(settings);
    BackgroundTask backgroundTask(settings);
    
    QObject::connect(&backgroundTask, SIGNAL(showConfig()), &window,  SLOT(showFullScreen()));

    return app.exec();
}
Settings and Background classes inherit QOBject, while ConfigurationWizard class inherits QMainWindow.
 
krk969's Avatar
Posts: 754 | Thanked: 630 times | Joined on Sep 2009 @ London
#6
what does your startup script in the event.d look like ?
and are you starting the above app in the startup file ?
do you see any error/trace ? or does the app not start at all ?
__________________
Developer of :
Buddy - budget/expense manager ( website )
Showtime - a telly channel listing viewer/reminder ( website )
Travelapp - london underground status/planner ( website )
Batlevel - desktop widget for battery level ( website )

“I hear and I forget. I see and I remember. I do and I understand.”
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#7
I know nothing about Upstart, so all I can do is give lame hints.

You may need the D-Bus initialization routines from http://talk.maemo.org/showpost.php?p...9&postcount=16 and, also, have you tried making it start when hildon-desktop has done so? I believe it's something like "start on started hildon-desktop" (alternatively, "start on started xsession" may work for you) in your Upstart service definition.
 

The Following 2 Users Say Thank You to qwerty12 For This Useful Post:
Posts: 146 | Thanked: 149 times | Joined on Apr 2010
#8
This is my /etc/event.d/imhere:
Code:
description "Starts the imhere application"

start on started hildon-desktop
exec /etc/init.d/imhere start
stop on starting shutdown
This is my current /etc.init.d/imhere:
Code:
#!/bin/sh

case "$1" in
  start)
    echo "IMHERE INIT CALLED" >> /home/user/startuplog
    /usr/bin/imhere
	;;
  *)
esac

echo "IMHERE INIT EXITING" >> /home/user/startuplog
exit 0
after booting my device I get following output in startuplog:
Code:
MHERE INIT CALLED
IMHERE INIT EXITING
 
Posts: 146 | Thanked: 149 times | Joined on Apr 2010
#9
Originally Posted by qwerty12 View Post
I know nothing about Upstart, so all I can do is give lame hints.

You may need the D-Bus initialization routines from http://talk.maemo.org/showpost.php?p...9&postcount=16 and, also, have you tried making it start when hildon-desktop has done so? I believe it's something like "start on started hildon-desktop" (alternatively, "start on started xsession" may work for you) in your Upstart service definition.
I'll have to check D-Bus initialization routines

I have tried to run my application from a init.d script inlcuding:
Code:
echo "SOME TEXT"
sleep 180
echo "SOME TEXT"
/usr/bin/imhere
echo "SOME TEXT"
, so it would for sure have the xsession and hildon-desktop, but I have got only all of the echoed texts, but app did not start,
I have checked with ps -A | grep imhere from terminal

Last edited by rachol; 2010-04-15 at 15:17.
 
krk969's Avatar
Posts: 754 | Thanked: 630 times | Joined on Sep 2009 @ London
#10
Code:
start on started hildon-desktop
script 
        /usr/bin/imhere
end script
can you try that script placed in the /etc/event.d ?
__________________
Developer of :
Buddy - budget/expense manager ( website )
Showtime - a telly channel listing viewer/reminder ( website )
Travelapp - london underground status/planner ( website )
Batlevel - desktop widget for battery level ( website )

“I hear and I forget. I see and I remember. I do and I understand.”
 
Reply


 
Forum Jump


All times are GMT. The time now is 00:15.