TOP
SSV Software Systems Register  Register
Log in to check your private messages  Log in to check your private messages
Startseite FAQ Search Mitglieder Profile  Log in 
SSV Support-Forum
Probleme mit autostart.sh

 
Post new topic   Reply to topic    SSV-Forum Forum Index >>> DNP/2110
<<< Previous topic - Next topic >>>  
Display posts from previous:   
Author Message
mauh



Joined: 13 May 2010
Posts: 2

PostPosted: 17.05.2010, 07:38    Post subject: Probleme mit autostart.sh Reply with quote

Ich versuche meine Applikation über die autostart.sh nach dem Einschalten des DilnetPCs automatisch zu starten. Mit einer "alten" Applikation hat dies funktioniert, mit meiner jetzigen Applikation geht es nicht mehr.
Wenn ich die autostart.sh über die Shell von Hand starte, funktioniert alles einwandfrei. Ich weiss nicht mehr weiter...

In /flash befindet sich meine Datei "autostart.sh":
-rwxr-xr-x 1 root root 336 Jan 1 14:02 autostart.sh

Diese hat den folgenden Inhalt:

#!/bin/sh
echo "---- STARTUP APPLICATION ----"

echo "Copy libs"
cp /flash//libpthread.so.0 /lib
cp /flash//librt.so.1 /lib
ls -al /lib

echo "Starting application"
./myapp &
echo "Started"

Wenn ich autostart.sh "von Hand" starte, dann geht alles wie gewollt.
Wird es jedoch beim Booten des Linux gestartet, kommt als
letzte Meldung noch "Copy libs" ... Schon die Ausgabe "ls -al/lib"
ist nicht mehr auf dem RS232-Startup-Bildschirm zu sehen...

Hier der Ausschnitt:

...
dnp2110 - jffs - JFFS version 1.0, (C) 1999, 2000 Axis Communications AB
JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications AB.
jffs2 -

Starting flash
Starting autoinit
Starting network Configuring and Starting Network : lo eth0-dhcp
Starting inetd: inetd
Starting httpd
Starting autostart Starting...
---- STARTUP APPLICATION ----
Copy libs


- SSV Embedded Linux - Version 0.20
emblinux login: root
Password:
Back to top
View user's profile Send private message
hne



Joined: 11 Jul 2008
Posts: 210
Location: Hannover

PostPosted: 02.07.2010, 15:08    Post subject: Reply with quote

Autostart selbst wird im Hintergrund gestartet, deshalb können Meldungen an die aktuelle Konsole vom getty (Login Prompt) überlagert werden.

Programme im Autostart sollten sich von der Konsole abkoppeln, nachdem oder kurz bevor diese in den Hintergrund geschickt werden.
Das erreichen Sie innerhalb Ihres C-Programms ducrh Schliessen von stdin, stdout und stderr und das öffnen der drei handle als Datei "/dev/null" (das sogenannte "daemonize"), oder im Script durch Umleitung aller Ein- und Ausgaben nach /dev/null.

Man darf nicht davon ausgehen, daß der Script autostart.sh im Verzeichnis /flash ausgeführt wird. Sie sollten innerhalb des Scripts mit absoluten Pfadangaben arbeiten, oder mit "cd /flash" in das gewünschte Arbeitsverzeichnis wechseln.

Die zu ändernde Zeile wäre:
Code:
/flash/myapp </dev/null >/dev/null 2>/dev/null &

_________________
Henry Nestler


Last edited by hne on 31.07.2023, 13:25; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
mauh



Joined: 13 May 2010
Posts: 2

PostPosted: 05.07.2010, 08:23    Post subject: Problem gelöst Reply with quote

Das Problem war folgendes:

Das Programm, welches ich starte, benutzt natürlich eine der vorher von Hand kopierten Libraries...
Scheinbar ist allerdings der Pfad auf die Libraries zum Ausführzeitpunkt der Autostart.sh noch nicht richtig gesetzt...

Die Lösung lautet: Library-Path von Hand setzen, dann gehts...

- Mit echo $LD_LIBRARY_PATH nachschauen, wie der Pfad auf die Libs auf dem System gesetzt ist
- Die Variable im autostart.sh dann von Hand setzen (und exportieren!) mit dem Kommando
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SSV-Forum Forum Index >>> DNP/2110 All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

SSV Software Systems GmbH

Dünenweg 5
30419 Hannover

Fon: +49(0)511  ·  40 000-0
Fax: +49(0)511  ·  40 000-40

sales@ssv-embedded.de


Impressum    ·    Datenschutz    ·    AGB

© 2023 SSV SOFTWARE SYSTEMS GmbH. Alle Rechte vorbehalten.

ISO 9001:2015