Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 23 Jul 2014, 05:52
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to run script at startup?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [4 Posts]  
Author Message
dfw55

Joined: 24 Jun 2013
Posts: 1

PostPosted: Mon 24 Jun 2013, 18:41    Post subject:  How to run script at startup?  

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:

#!/bin/bash

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

read -p "   Continue?   " -n1 yesno

exit

Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5009
Location: Arizona, U.S.A.

PostPosted: Wed 26 Jun 2013, 02:53    Post subject:  

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
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3953
Location: Kiel,Germany

PostPosted: Wed 26 Jun 2013, 04:23    Post subject:  

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:
#!/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 Razz
BTW : why do you know about gtkdialog-splash ?
>/dev/null is something for criminals, especially when it comes to test scripts .
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4277

PostPosted: Thu 27 Jun 2013, 05:22    Post subject:  

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.
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [4 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
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
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0481s ][ Queries: 12 (0.0036s) ][ GZIP on ]