How to run script at startup?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
dfw55
Posts: 10
Joined: Mon 24 Jun 2013, 22:15

How to run script at startup?

#1 Post by dfw55 »

First you need to know that I am a TOTAL nooby when it comes to Linux and bash.

I want to do some things when linux first starts up. I wrote a really simple script just as a basic test to make sure I knew what I was doing before I proceeded any further. But, even my simple script is giving me fits!

Now, this script runs just fine when I run it in Geany. I get the splash text and a bash window that shows my prompt.

But, when I copy this script to /root/Startup, when I boot, I get the splash text, but NO bash window. My splash text appears until I close it, and then nothing else happens.

How do I get the bash window to appear showing my "Continue?" prompt?

Code: Select all

#!/bin/bash

gtkdialog-splash -bg green -close box -text "   This is a test...   " > /dev/null 2>&1

read -p "   Continue?   " -n1 yesno

exit


User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#2 Post by sunburnt »

Hi dfw55; I assume you want your script to run at the boot screen?
/root/Startup comes very late in the boot process.
Try putting the line that runs your script in: /etc/rc.d/rc.local
This is run before the desktop is started.

Also you should ask Flash or other monitor to move your thread to the section: Programming

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#3 Post by Karl Godt »

You need to know, that every program that runs forked from background scripts, don't have a controlling terminal .
No controlling terminal means
a) no job control in this shell
and
b) no direct input to shell builtins
.

/etc/rc.d/rc.local does not know about DISPLAY yet and would likely not launch gtk-apps .

/root/Startup would be the place to put it, but needs a termial
like

Code: Select all

#!/bin/bash

echo '#!/bin/bash
gtkdialog-splash -bg green -close box -text "   This is a test...   " > /dev/null 2>&1

read -p "   Continue?   " -n1 yesno

exit
'>/tmp/mystartup.sh

chmod +x /tmp/mystartup.sh

rxvt -e /tmp/mystartup.sh
You might alternatively change #!/bin/bash to #!/bin/noob or #!/bin/crash :P
BTW : why do you know about gtkdialog-splash ?
>/dev/null is something for criminals, especially when it comes to test scripts .

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

#4 Post by technosaurus »

Geany opens a terminal to run scripts, so read works in that terminal. Rather than read, I would use Xdialog, yad or gtkdialog for user input in X.
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].

Post Reply