The time now is Thu 26 Apr 2018, 07:52
All times are UTC - 4 |
Author |
Message |
dfw55
Joined: 24 Jun 2013 Posts: 9
|
Posted: 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
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 5087 Location: Arizona, U.S.A.
|
Posted: 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
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 4208 Location: Kiel,Germany
|
Posted: 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
BTW : why do you know about gtkdialog-splash ?
>/dev/null is something for criminals, especially when it comes to test scripts .
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 4787 Location: Kingwood, TX
|
Posted: 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.
_________________ Check out my github repositories. I may eventually get around to updating my blogspot.
|
Back to top
|
|
 |
|
|
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
|