General :: Stopping Ksh From Exiting After Running A Command?
Nov 26, 2010
I want to launch a gnome-terminal with a korn shell, and I want to specify in advance a command to execute, and then hand control back over to ksh. ex.
Code:
gnome-terminal --execute ksh -ic ls
I expect that to run ksh, do an 'ls' for example, and then give a prompt. I thought the -i switch (for interactive) meant that the shell would resume control, but this doesn't happen. The window just closes quicker than I can see what was output.
One of my servers needs to issue an "apt-get update" command on each of the clients in a lab. However, after the first update, it exits. In trying to replicate the problem with a simpler script, I created the following which fetches the listings of multiple directories from a client:
NUM=0 cat paths | while read DIR; do ssh server-name ls $DIR > /tmp/$NUM.txt NUM=`expr $NUM + 1` done
Again, after the first iteration, the script exists. I tried the following line too, but it made no difference:
I tried to stop kvm and kvm-amd modules to run at boot by adding; Code: blacklist kvm blacklist kvm-amd at the end of /etc/modprobe.d/blacklist and reboot PC. However it doesn't work.
I want to have a script (tcsh/bash/python) that launches a bunch of gnome-terminals (or 1 with multiple tabs). And I want it to execute a command, but keep the shell interactive. Currently, if you type gnome-terminal then it launches a new interactive shell, but if you give it the execute flag, then it executes the command and quits (or stays open, but non-interactive depending on the users gnome-terminal settings).
I have this command which I want to run automatically before I start working. What the command does is dynamic and different for each shell. It takes arguments. So it's not something I can take care of in a .cshrc type file.
Boot of a new minimal system hangs on "Stopping save kernel messages" or "stopping system v runlevel compatibility". I have ubuntu minimal iso x86_64 from usb stick created with unetbootin (don't have a cd drive on the machine in question), and after that I didsudo aptitude install gnome-terminal network-manager-gnome gdm geditsudo rebootnever got a system back. Annoyingly I can't boot into the recovery mode either, and it seems the keyboard is only semi-responsive (i.e. many dead keys when at the grub menu).qualms about reinstalling, but I've done this a few times and ended up at the same place every time.
In December I finally filled up my root partition and broke Suse 11.1. I therefore resized my partitions and installed Suse 11.3 on /root. I didn't not touch my /home partition.
I notice that when I leave my machine and come back the screen has locked. I have tried to turn off the screensaver, but it hasn't worked. I have Googled, but unfortunately the screen shots don't look like what I have and the instructions to stop this do not seem to match what I am seeing on the screen.
I like less and use it as my default pager in Linux. However, there are times that I am scrolling down through a large document quickly and less exits when I reach the end of the document before I have time to stop scrolling. I'd like less to exit only I type q, and not because I ask it to scroll beyond the end of the document. Is that possible?
i have a shell script which some of the lines should be running as root and some other not.the problem is that su is not practically work,it means it take root password from me but it does not run the commands in script.the other problem is thatthere are some commands which should be run as normal user so how it exits from root mode and run that particular command. i tried exit in script file but it dos not work.
I am trying to use the at command to run a script file. The test was quite simple, wanted to run today and every 2 days.Here is the at command:at 15:20 today + 2 days -f every2daysDo.shHere is the script:echo "every2daysDo.sh ran on $(date)" >> /home/stacy/attest.logI see the 'output' of the echo command in my log file on today+2 days, but not on the day that I start it.
I'm running this command, and seems not to work, following the command:Quote:for nic in `ls /sys/class/net | grep -v lo`; do echo ${nic}; udevinfo -a -p /class/net/{nic} | grep -i address; doneThe output is the following:Quote:eth0eth1But the output should show something like this: (showing the MAC address)uote:
I am trying to run an scp command on my linux server, this is working fine, however I changed the output folder to one which has spaces and now when run, it's coming up saying SCP ambiguous target
If I start a script that is going to take a long time, I inevitably realize it after I've started the script, and wish I had a way of doing some kind of alert once it finishes.
So, for example, if I run:
really_long_script.sh
and press enter...how can I run another command once it finishes?
i know that there is already a command for it but it comes out with a lot of letters that makes it hard to find the services that are runningi'm talking about services like DNS, APACHE, DHCP, SAMBA, SSH etcis there a command that will list these services and related services that are running instead of showing a bunch of jumbled and lettered mess thats hard to comprehend
I want to remote login as a non root user and then run a command under the root account.I have set up the ssh/scp for the non root user and this configuration works fine. What I dont know is how to run a command under root once remotly logged in as the non-root account.I have to run this command under root, it cannot be changed.
i use the csh shell at work. you can either log on to servers locally or to the NFS mount. is is important to know which you are mounted to when executing scripts. csh is the only shell that lets me know which high availability server i am currently on.
before i write a shell script to complete a task, i have to type sh or bash at the prompt, hit enter and then configure the script. then when i am done, hit control -d to get out the bash or sh shell.
is there a way to run sh or bash scripts from the csh command line - i have tried typing this at the csh command line: /bin/sh (or ./bin/bash) while [ 1 ]; do ps auxwww | grep fire | wc -l ; done ... etc, but it does not work.
I have tried to install ns-allinone-2.29.....i followed the process given on the net....everything got installed properly except tcl and i got the following message tcl8.3.2 configuration failed! Exiting.... Tcl is not part of the ns project
I am using on Windows Vista, Filezilla server. I have it set up to be accessed via outside IPs and when I use a client on the IP I have it connects normally using Filezilla client. On the same machine I have Ubuntu running in a virtual box and when using filezilla client in there it works fine. Now I want to try the command prompt. So I do the ftp xxx.xxx.xx.xxI enter the name and password and i get the ftp command prompt, but the commands are not working properly. when trying "ls" or "cd" these commands do not work. "cd" tells me that the current directory is "/" root, but this does not make sense in the windows operating system. Now the filezilla client is taking the user in the application window directly to the root folder of the permitted filespace granted to that user. How can the same be done from the command prompt, if there is a way? It is as if the command prompt takes me to the root which does not exist or even have correct permissions to move in. Is there any way to be taken to the correct directory directly, or move there especially when the slashes are the wrong way around etc?
Yesterday I installed OpenOffice on my Linux server. But when I go to run it through the command line, it says command cannot be found. I've also tried other things like OOWriter, etc. Has anyone had this problem? Installation process went like below: root@aserver [OOO330_m20_native_packed-1_en-US.9567/RPMS]#
rpm -i *.rpm package openoffice.org-ure-1.7.0-9567.i586 is already installed package ooobasis3.3-core01-3.3.0-9567.i586 is already installed package ooobasis3.3-en-US-3.3.0-9567.i586 is already installed package ooobasis3.3-core02-3.3.0-9567.i586 is already installed
I can make aliases fine by editing the .bashrc file in my home directory, but the first thing I do when I open a terminal window is sudo su so I don't have to type sudo in front of every command. The problem is, I am then not able to use my aliases. How can I make aliases that work after I run the sudo su command?
I want to run this command on startup. xmodmap /etc/xmodmap I am running Ubuntu 10.10 and need to remap keys. It only seems to work when I run it in terminal after I login.
I'd like to start a background job using the sudo command and route its output to a file. This presents a problem because the prompt for the password doesn't work properly. It looks something like this when I try it:
Basically I'm not properly prompted for the password and as soon as I type anything in my background job fails because it didn't receive the password. Is there any way to execute a sudo command by supplying the password on the same line as the command?
I am running the command on a Mac but due to it being a generic unix command and a command line query.. I thought I can write on this forum.. I am running the command
Code: df -h | grep '/dev/' I get Code: /dev/disk0s2 389Gi 62Gi 327Gi 16% / /dev/disk0s3 76Gi 24Gi 52Gi 32% /Volumes/Backup /dev/disk3s2 500Gi 47Gi 453Gi 10% /Volumes/Misc Note the huge space between the 1st and 2nd Column..
This is because currently I have some NAS drives mounted which are not showing due to grep. When they are not mounted. The output is fine with equal spaces between each column (like between col 2 and 3.. or 3 and 4). I want to do a (dare I say) sed or awk or something to reduce the space between 1st and 2nd col. So that it has space like between col 3 and 4.. or 2 and 3. This is because I am showing this output somewhere and because of the space its not showing up correctly.Also I hope the command will still work when the NAS drives (afp) are not mounted.. basically consistency. The spaces are not showing properly in the quote tag. Changed it to CODE tag.
How to submit multiple jobs onto a Linux server. The only way I know to submit and run a job on a server is using qsub, and verifying the status of the job using qstat. I usually run my scripts using qsub -cwd so that I can run it on my own directory (instead of having the results sent to a scratch folder).
1. However, assuming qsub/msub are not available, is there another way to do it? What commands can I use instead? 2. I know that some jobs can run in the background, is that an alternative? How do I do it? And would I still be able to check the status of the job or delete it?
I'm trying to remotely run a script on a target machine though the ssh command-line using passwordless login. I know the keys are set up correctly because if I remove the call to the script, the ssh session succeeds and I can log into the remote machine, but when I call the csh script, I don't get any output on the command line. If I call an identical bash script, I do get the output. Specifically, calling line 1 below just returns me to the command line, but running line 2 echo's hello then returns to the command line (both scripts simply contain a single line to echo hello, and both work when run locally on the remote machine). Why do my csh scripts send any output through the ssh link whereas the bash does?
2) ssh -i /root/.ssh/id_rsa user@remotemachine /tmp/test.bash Update: I have further determined that nothing I add to the csh gets run either. I've tried touching files and making directories in the scripts, and all gets run using the bash script, but calling the csh script like line 1 above does nothing, nothing is touched or created.