xterm script runs differently from /root/Startup [SOLVED]

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

xterm script runs differently from /root/Startup [SOLVED]

#1 Post by greengeek »

I am wanting to run a script in a terminal, straight after boot. This is intended to achieve the following:

1) The user can see clearly that the script is running
2) The script can output errors that the user can see,
3) The user can terminate the script easily by shutting the terminal.

In order to achieve this, I can't just place my target script in /root/Startup - it would run ok, but not in a visible terminal. So what I am trying is to place a "starter" script in /root/Startup as follows :

Code: Select all

#!/bin/bash
sleep 5
xterm -e ./vox/targetscript -hold
this starter script kicks off the targetscript which is in directory /root/Startup/vox

(I had to put it in a subdirectory of Startup as that is the only way it seems to work)

If I click the starter script - it works perfectly. My target script gets started in a terminal, shows any output as required, and terminates when I close the terminal window. However, it does not run successfully after the boot process - I do see a terminal open up but it closes before I can see anything in it.

I've tried different sleep values in case the script was trying to start before something had "settled", but that only delayed the appearance of the self-closing terminal window.

I would like to know what it is about the boot / Startup process that causes this script to behave differently to when I just manually click it.
Last edited by greengeek on Wed 06 Nov 2013, 15:47, edited 1 time in total.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#2 Post by technosaurus »

/root/Startup was deprecated before it was even implemented, just haven't felt like implementing: http://standards.freedesktop.org/autost ... atest.html
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Ibidem
Posts: 549
Joined: Wed 26 May 2010, 03:31
Location: State of Jefferson

Re: xterm script runs differently from /root/Startup

#3 Post by Ibidem »

greengeek wrote:I am wanting to run a script in a terminal, straight after boot. This is intended to achieve the following:

1) The user can see clearly that the script is running
2) The script can output errors that the user can see,
3) The user can terminate the script easily by shutting the terminal.

In order to achieve this, I can't just place my target script in /root/Startup - it would run ok, but not in a visible terminal. So what I am trying is to place a "starter" script in /root/Startup as follows :

Code: Select all

#!/bin/bash
sleep 5
xterm -e ./vox/targetscript -hold
this starter script kicks off the targetscript which is in directory /root/Startup/vox

(I had to put it in a subdirectory of Startup as that is the only way it seems to work)

If I click the starter script - it works perfectly. My target script gets started in a terminal, shows any output as required, and terminates when I close the terminal window. However, it does not run successfully after the boot process - I do see a terminal open up but it closes before I can see anything in it.

I've tried different sleep values in case the script was trying to start before something had "settled", but that only delayed the appearance of the self-closing terminal window.

I would like to know what it is about the boot / Startup process that causes this script to behave differently to when I just manually click it.
How long does the script run for?

Are you sure that /root/Startup is $PWD during startup?
I would suggest giving a full path to the script.

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

Re: xterm script runs differently from /root/Startup

#4 Post by greengeek »

Ibidem wrote:How long does the script run for?
The target script is intended to run indefinitely (it monitors microphone output for spoken commands that control the computer)
Are you sure that /root/Startup is $PWD during startup?
I would suggest giving a full path to the script.
Good question. I don't understand the term $PWD. Could you elucidate please?
I did try giving a full path to the script but that prevented it running at all...
cheers!

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#5 Post by greengeek »

technosaurus wrote:/root/Startup was deprecated before it was even implemented, just haven't felt like implementing: http://standards.freedesktop.org/autost ... atest.html
Well, I don't seem to have a .config/autostart directory.

However I DO seem to have an /etc/xdg/autostart menu. I need to give that a try...

I will report back if I make any progress...

EDIT :Nope, I tried putting the starter script and the vox directory (containing the target script) in /etc/xdg/autostart but all I got was the same quick flash of dying terminal after boot. At least it shows that that directory is in use as a boot time startup directory (at least in Upup Raring 3992...).

I guess I have some issue with birthing/killing child processes or something. I will do some more googling...

I remember reading at some point about an xerrs logfile. Could that be of some use here? (I don't know where to find it...)

cheers for any help...

User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#6 Post by CatDude »

Hello greengeek
greengeek wrote:

Code: Select all

#!/bin/bash
sleep 5
xterm -e ./vox/targetscript -hold
Try this instead:

Code: Select all

#!/bin/bash
sleep 5
xterm -hold -e ./vox/targetscript
CatDude
.
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#7 Post by musher0 »

greengeek wrote:(...) I remember reading at some point about an xerrs logfile. Could that be of some use here? (I don't know where to find it...)

cheers for any help...
/tmp/xerrs.log
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#8 Post by greengeek »

CatDude wrote:Try this instead:

Code: Select all

#!/bin/bash
sleep 5
xterm -hold -e ./vox/targetscript
Thanks CatDude. With one small change this did work - I needed to use the full path as follows:

Code: Select all

#!/bin/bash
sleep 5
xterm -hold -e /root/Startup/vox/targetscript
musher0 wrote:/tmp/xerrs.log
Thanks musher - I did see lots of error messages in that file but I guess they relate only to xorg - apparently I have issues with the nvidia driver and various font deprecation issues :?
Will have to look closer at that and decide if I should worry or not...

Thanks for the help guys - I will mark this as solved.

EDIT :Interestingly - if I try the same method utilising the /etc/xdg/autostart directory it does not run (either specifying the ./ path or the full path). That version of startup must be slightly different...

Post Reply