Ubuntu Servers :: Invoke Script On Boot By Pressing Key
May 1, 2011
I have created a script which asks the user a few questions and then it configures the wireless network. I'd like to run it somehow while Ubuntu still boots by pressing a key for example. Let's say, while booting, when it comes to the script I made, it will sleep for a few seconds giving the user the oportunity to press the pre-defined key (eg: spacebar). Once pressed, then the script will load.
I have to execute certain commands (like shutdown Tomcat) on several servers so I'm using a loop and ssh. I put the server's IP on a CSV file which I parse, execute the commands for each line and send the output to a file. The problem is that after processing one line the program stops execution. I wonder if someone could lend me a hand with this, I'm new in bash scripting and I ran out of ideas.
The CSV (servers.csv) file looks like this:
Code:
192.168.254.5:Server 1 192.168.254.6:Server 2 ...
And the script looks like this:
Code:
#!/bin/bash while IFS=: read ip name do sshpass -p "pass" ssh -o "StrictHostKeyChecking no" root@"$ip" 'sh <CATALINA_BASE>/bin/shutdown.sh' >> output.log done < servers.csv
I have a file server running Ubuntu 9.04, with 2 1Tb Drives. I did a normal shutdown, and when I attempted to start the server again, it returns an error of Drive error. Then I must press F1 to resume. If I disconnect the 2nd Hard disk it will boot normally after pressing F1. If I leave the Disk connected it just hangs up after pressing F1. I can run it with 1 disk, but I cannot run it headless if I have to press F1 to start it every time.
AMD single core CPU Asus mobo A8N-VM RAM 512x2 M Ubuntu 9.04
When I turned on the PC in the morning. It failed to boot. Pressing [Del] had no function. The [Num Lock],[Cape Lock] and [Scroll Lock] flashed once. Please advise where shall I check.
i tried resetting my linux based PC and it did not come up thereafter. i power off and on the PC, yet it did not come on. i assistance in resolving this problem.
I am working as system administrator for the past 5 years, but only on Windows XP systems, I recently moved to Linux, frankly speaking a few days ago, and i got many problems with it. may be as i am a beginner. My Problem started with Ubuntu 9.04 amd 64 and now with 10.04 beta.
The main problem I installed the wine (I am aware that wine is not compatible with all softwares of microsoft) and Installed microsoft office 2007 and it installed successfully but after installation when I launched Microsoft Excel it got hanged (only the Microsoft excel) and loading logo stood on top of all applications, then I decided to restart and pressed the restart button from menu on the right top. but there was no further response, then I pressed the reset button after waiting for 3-4 minutes to get rid of that logo of Microsoft in the center of my screen.
Now, when the Ubuntu was booting, Text arrives and disappears fast saying dev/file system has errors the logo of Ubuntu 10.04 and dots of loading at the bottom arrived and text written in the bottom of that "on of the drives needs to be checked, please wait it may take some time" Press 'C' to cancel disk check up. Now, its checking for a long time maybe for 30 minutes and the bottom text disappears and the loading Ubuntu 10.04 logo still remains and nothing happening after that.
I Pressed alt+crtl+del 2 times, it restarts saying that saving some alsa process, then again the same thing after restart. If I press C, it displays in the bottom of Ubuntu 10.04 logo "/File system has errors" and the loading screen remains like that. Now what is the solution and what are the precautions to be taken while using Ubuntu, as I was interested in introducing Ubuntu to marketing managers of offices, who wonder on the Internet all the time finding stuff and getting attacked by viruses. If this type of problems continue in Ubuntu, it will not be safer to use it, as if it wont boot during sudden power failures, that could result in a big problem.
I am running usb version of lucid 10.04.2, with many apt-get installs. Shortly after running awhile, programs will not run, I get either an "input/output error" or "Bus error (core dumped)". (Examples of programs rendered inoperable are top, df, file)
I've read something about a memory leak in Lucid, but in my case, the computer doesnt slow down, things just stop working. Is this a known problem with Lucid? I'm thinking maybe one of my apt-get installs corrupted something. Is this a known problem that has a software update available?
Here is the output of "top" which fortunately currently DOES work, while other progs don't. (the memory usage stays constantly in that 1.5 GB range)
I want to use php for mailing on linux.But when I do it with"$a=`msmtp niubl967@gmail.com < /u1/ftp/mail.txt &`",it does not work.The mail.txt's contents are following:
setting up the Xterminal ( xmanager ) application on Linux. I've installed Xterminal-1.0.7-1.i386.rpm on RHEL 4.0.May i know how could i invoke the installed application? What commands should i use?
If a process becomes unresponsive in WINDOWS then we press "alt+ctrl+del" to invoke the task manager & then terminate the process.Is there any similar way to invoke the Linux Terminal so that we can end a process by the 'kill' command when it becomes unresponsive?
Adobe Air are not able to invoke the password dialog for installing apps in opensuse11.3 (i686) .. it waits for root password confirmation however there is no dialog window to input the password to. I've tried installing adobe air apps as both su and normal user, no mather what I do it's not envoking the password dialog..
I've also tried to install the gnome su library to see if it helps any but it don't...
I have also tried to reinstall Adobe Air using both the rpm installer and the binary installer from [URL], the binary installer won't even install.
I can get the use of the AIR apps I need ?
From AIR installation log [Adobe AIR Application Installer:12808][INFO] Waiting for user confirmation
Edit: By the way, I've also tried the normal troubleshooting such as removing the crypt cataloge, removing cache and etc..
My main problem right now is doing floating point arithmetic within a bash script, with variables.Right now I have a folder called "myExamples" with a script called "run_example" that runs with no issues.I plan to(1) create many folders inside [myExamples], that are named [example10] [example11]...each containing an identical copy of (run_example),(2) modify Line 172 of each copy of (run_example)...in one copy, it would be 3.00, the next copy would have 3.05, etc. (This part doesn't work!)How can I use the available calculator bc code to do floating point operationsMy code is below -
#!/bin/sh # run from directory where this script is cd `echo $0 | sed 's/(.*)/.*/1/'` # extract pathname
to use this command, i have to be in su or sudo. Is there a way I could allow all users to invoke these commands without the root password?? I try to make a file (wireless.sh), which consists the commands above, in /usr/local/bin/. Change the mode to 755 (chmod 755 wireless.sh) however, it does not allow me to use this also.
I'm working on an application which generates random shapes when clicking on a window. I designed the window using Motif. I want to invoke the ButtonPress Event .
I have created a glade file which so far have two regions in it:
1) On the right division is a toggle button which calls a C script when enabled.
2) I have a drawing area, in which I would like to plot a point (X-Y scatter plot). The plot should be generated dynamically using a C script. I am not sure how the integration between the two is possible for a drawing area.
In glade what properties of drawing area should I set? eg.expose event, realize etc. I was thinking of using cairo for generating the plot.
I'm trying to do a little bit of setup on our new server and could use a hand.I'm working on creating a simple display script that our users can SSH in and invoke, here is what I'm attempting to do.
Requirements.
1. Must run X over ssh on Mac OS X 10.5 or greater
2. Must work in the office, or on the road
Implementation: 1. Set up the system to auth against LDAP (Open Directory)
2. Create a script on the PATH that checks which displays are available, and launches Xephyr for the first available one.
3. Create a client script that performs the SSH and Xephyr command so that users can simply click the script to start an X session.
I have 1 set up, but I'm having issues with 2 and hence 3. For instance, I can start XNest with the following commands.Start my SSH session
My computer is connected to the college lan where almost all machines are some variant of Windows OS. If i use Places > Network, while windows network is displayed, mostly it returns unable to mount shares, my workaround for this problem is I use some tool like nbtscan to see which hosts are up and then use network > Connect to Server > windows share and type in the ip address, this mounts the windows share even though Places> network doesn't display such hosts. My question is there some command line way where I can invoke nautilus to mount the windows share, ie the same job connect to server > windows share does? And is there some application like say lan surfer for windows which lists all the folders shared by a windows client.
I have a very strange problem. My computer is unable to boot from any hard disk but is able to boot from any CD or DVD. I have double-checked the BIOS settings and I am unable to figure out why is this happening. I have noticed that the Windows installer boots from the CD only if one presses a key when the message "Pressany key to boot from CD..." is displayed on the screen, otherwise it boots from the first hard disk.I have a triple boot system with Windows 7 (64-bit), Ubuntu 10.10 (64-bit), and Fedora 14 (64-bit). I have a dedicated GRUB2 partion on one of my disks. What I want is a boot-loader (any would do) on a CD/DVD/USB drive to chain load the GRUB2 present on my hard disk, without a delay, that is, without showing any message, menu, warning, etc. So, is there a way to do that?
Compiz often keels over and then I have to restart the comptuer because even though I made a special script to restart it, I am unable to invoke it as I cannot change active window.However, since Metacity restarts itself, so should compiz. The question is - how?
ive just upgraded to ubuntu 11 and everything is good so far i love it but for some reason I have to press shut down twice as it does not seem to register the first time. This also happens with restart does anyone else have this problem or am i missing something ?? Just to clarify im clicking on the power icon in the top right then selecting shut down in the menu (not the power button on my computer).
I have a Asus EEE 1000h with ubuntu 9.10 remix. A problem on first asus eee's is the keyboard: also just typed a letter once, the laptop writes it double (every 200 letters more or less). For example it looks like this while writing: "thiss is a ttest" For Windows XP I found a way to fix it: i increased the time, that limits writing letters twice by fast typing. Its not the time "Repeat Keys" Delay (Keyboard Settings "Key presses repeat when key is held down")! In fakt its the opposite: It limits pressing the key to fast. (I hope you understand the problem *g)
I'm running a Toshiba Satellite laptop and am having trouble with the function or Fn keys. When running xev from the terminal I get no output for when I press the Fn key and I can't assign any keyboard shortcuts using it. However I'm still able to use some of the Fn+F# combos such as lock the screen or mute.
I've installed Ubuntu 11.04 and am using Unity as my desktop environment. Everytime I press the TAB key there is a mouse freeze for about a second. This happens whenever I do ALT+TAB or simply the TAB key by itself.why this may be happening and if I can do anything to fix it? It's really bothersome,
I am able to invoke 'skype' using the following command in a Terminal window. < export XLIB_SKIP_ARGB_VISUALS=1 && LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so && skype & >. I want to be able to enter it through the Gnome Application interface. I right click on the skype icon and went to properties and added the above code. When I click the icon I get the following error message set out on the attachment? properly enter the commands within the application Command: line?
Can't get into terminal mode by pressing any hotkey CRTL+ALT+F1 .... F6.Displays seems to freeze, a blank screen is shown whit some bright spread pixels at the top. Although I can return to graphical mode by pressing CTRL+ALT+F7 without problems.
I am running a Java application on the command line bash terminal under Mint Debian. I have JDK1.6.0_22 installed 64-bit, and the OS is 64-bit too. I have a few JAR files in the directory and a few native LWJGL libraries. When I run the application using the command line, all works fine. Lets assume my directory where the files are is called /home/riz/MyGame. I change to that directory and this is the command I use code...