General :: Shell Script Fails To Exit / Troubleshoot This?
Feb 9, 2010
This is a very simple problem, but I'm scratching my head with others..
In composing a simple shell script in class, we can't seem to get the script to execute fully. script was formatted as follows.
#!/bin/bash
echo "good bye for now"
exit
did, Chmod 755 to make executable
type file name "bye"
runs but wont exit.....
it just echos the type"good bye for now
The instructor says it works for him at home....
But it wont work in class...
Is there a reason it wont "exit" the shell as commanded ?
View 11 Replies
ADVERTISEMENT
Feb 15, 2010
I have a shell script that creates a file and at the end I want to mail the contents of the file to myself or a group.
Here is what I have but I the script halts and I have to hit <ctrl-d> the n I receive an EOT and the mail is sent.
What I need:
- how to terminate the mail to where is terminates automatically
- can I cat the file contents instead of using -a
View 1 Replies
View Related
Aug 18, 2009
I have 2 shell scripts, script1.sh and script2.sh. I call script2.sh from within script1.sh ( by simple ./script2.sh command). Based on some condition, i use exit 0 to exit out of script2.sh. I was trying to find if i can exit out of script1.sh as well at once. below is the example
script1.sh
#!/bin/bash
echo "Before ..."
[code]....
When i execute below is the output
Before ...
There was problem file is empty
The Script will Exit. Please fix the issue and run again...
After ...
I am trying to exit out of script1.sh as well so that i dont print "After ..."
View 3 Replies
View Related
Jun 14, 2010
My two doubts:
(i) In office i open many terminal windows when i start my day and in each terminal i keep on login as different users many times in a day to do some task, by the end of the day when i need to exit from all terminals in a safeway instead of directly closing it i need to execute exit command or CTRL+D many times to close a single terminal safely. Can anybody tell me a way to exit from each terminal in single go, is there any command to acheive this ? I wish if we had a command like exitall like in vi we have :qa command to close multiple files opened in single window. I hope friends you have got what i am asking for ?
(ii) I want a software for debugging shellscripts searched a lot but dint got it.
View 7 Replies
View Related
Apr 1, 2011
I write a script to read a file which is something like a pipe (or) queue , which shows the running status.In normal case, if i open this file with cat command, i have to use ctrl+c to exit this . What command shall i use to do the same inside a shell script ? I have tried ^C in my script , but it does not exit the process.
View 6 Replies
View Related
Dec 8, 2010
After updating recently VLC does not play audio or video, and it does not complain about not being able to do so, even when running from terminal.
The version is VLC media player 1.0.6 Goldeneye.
I have tried resetting the preferences.
I don't know how to troubleshoot any further..
View 2 Replies
View Related
Jun 4, 2011
I recently purchased a new Lenovo Thinkpad T420i and am having problems installing the latest version of Squeeze from CD. After receiving the laptop, I started it up, configured Windows 7, and confirmed everything is working correctly. Next I went through the Debian installer, which completed successfully. I'll be dual-booting Windows 7 and Debian, so at the partitioning stage I resized my NTFS partition, added a shared VFAT partition, then used the "Guided" install to create my root and swap partitions. My partition layout is code...
I assumed something was wrong with grub, so I booted the CD into rescue mode and chose to reinstall grub onto the Master Boot Record. But nothing changed. Just to experiment, I went into fdisk, deleted all my new partitions (leaving just the Windows ones), and tried rebooting, but the same error happened. I then went through the Debian installer again, being careful to set everything up correctly, but still, the device won't boot.
I'm not even getting to the grub boot screen, so something is wrong even before the point. Reinstalling grub to the Master Boot Record (grub-install /dev/sda) isn't changing anything. How can I troubleshoot this?
View 8 Replies
View Related
May 14, 2010
How do i run a part of code on exit in a shell script?Suppose i have four echo statements like the following:
echo "Stmt 1"
echo "Stmt 2"
....some code goes here...
[code]...
View 2 Replies
View Related
Jul 27, 2010
Someone gave me a script that would tar then gzip my music directory, as well as remove the previous days backup. I have it set up in crontab, but it appears to have stopped working the last couple days, so i tried running it manually. Below is the script and the output I got. Any ideas why its failing now? I don't think anything changed on the server, maybe someone installed updates but idk why that would affect this.
Here's the musicbackup.sh script code...
View 3 Replies
View Related
Nov 20, 2010
I'm attempting to mount a Windows dir to a mount point on my Linux VMWare instance running on my Windows 7 machine. I am using a shell file to automatically mount the directory I want at bootup. However, I'm finding that Linux always mounts to a directory at the top of my C: file structure for some reason, and I can't figure out why.
Here's the dir structure:
C:/target (don't want to mount this, but this is what gets mounted)
C:/Users/me/target (this is what I want to mount to)
Here's my shell script:
Code:
mount.cifs //192.168.56.1/Users/me/target /mnt/target -o credentials=/root/credentials.auth,domain=mycomputer,uid=1001,gid=1001,rw
And here's what I get when I enter mount at the prompt:
Code:
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /boot type ext3 (rw)
none on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
If this means anything my Virtual Machine has a single hard drive SCSI, which I believe is /dev/sda1. I don't see anything from mount that would indicate that the c:/target dir is getting hard-mounted somehow from the /etc/vfstab file, but maybe I just don't understand how mounting works...
View 2 Replies
View Related
Feb 12, 2011
When I try to launch application which runs in another window (not inside shell), it always fails with this kind of message: (example from gnome-terminal)
Code:
** (gnome-terminal:2477): WARNING **: Failed to connect to the session manager: None of the authentication protocols specified are supported Failed to get the session bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
Falling back to non-factory mode. Failed to summon the GConf demon; exiting. Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See [URL] for information. (Details - 1: Failed to get connection to session: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.) I am running it as root, have GNOME installed and running, and also fresh install of gconf.
View 8 Replies
View Related
May 3, 2011
I am having trouble using grep command. I want to search for each line in first file in second file and if they are present, write to file called successfile else to failfile. Below is the code
what is happening is, when the first failure occurs (when a line in first file is not present in second file), the script is killed.
Can anyone please tell me what I am doing wrong? code...
View 4 Replies
View Related
Mar 9, 2010
I tried to create a user on Solaris 10 but when I try to login the user with "su -" I get the error message "no directory". When I try to login with "su" I get the error message "no shell".
I tried the useradd several combinations e.g.
All the tries i made didn't work. I also checked the permissions on /etc, /bin, /sbin and / and it seems ok so that the newly created user can access them.
View 14 Replies
View Related
Apr 11, 2010
I noticed that if I have "exit" in a bash script file., e.g. script.sh,that when the word "exit" is reached, and the script file being executed is not in the PATH nvironment, i.e. ". script.sh", the whole konsole shell profile is exited! What gives here? Is there another command compatible to "exit" to prevent this, or will I just have the leave the "." part in the PATH enviroment, which is, to my understanding, is not recommended? I desire for a "goto" function in bash script files
View 11 Replies
View Related
May 22, 2010
In linux, creating thread is same as process (clone()), except the virtual address space gets shared with the parent.If a running main process(thread) creates new thread, and if main thread exits, why should the new thread too exit? both are different entities, The same doesn't happen if the child thread exits, the parent thread would be alive.
View 1 Replies
View Related
May 21, 2010
Now that the server is set up, whats the best way to troubleshoot this server if problems should arise?
View 2 Replies
View Related
Dec 18, 2010
I have the problem where the email was sent but not received by users.. The message as below code...troubleshoot
View 2 Replies
View Related
Mar 28, 2011
How can I troubleshoot disk with 'dmesg' cmd ? How to distinquish :
- physical disk error
- file system corruption
What is I/O Error ?
View 1 Replies
View Related
Jul 14, 2010
I installed the ubuntu 9.10 cd and for some reason as of last night it only boots halfway. it shows grub, shows loading keymap nd apparmor profiles, then before it shows mpd and apache load it erases everything and stops at a dark grey screen. all before i get a shell of any type. if i leave it alonethe screen still darkens like its going to sleep. is there any way to troubleshoot and fix this?
View 2 Replies
View Related
Jan 26, 2011
I have a VPS that I'm using as a web/mail/DNS server (all-round server) and is repeatedly falling over every 12 hours or so. It seems to be since I used a Wordpress plugin on one of my sites to send out an email newsletter - I had problems with the plugin itself, anyway.
I think it might be causing a memory issue, as I've run 'free' and 'top', which sometimes causes a "fork:Cannot allocate memory" message to appear. Other times it displays statistics and suggests that there's plenty of memory available. Are there logs that I should look at and if so, what should I be looking for? Also, how can I stop this rogue plugin from doing anymore damage, seeing as it still appears to be running?
View 5 Replies
View Related
Feb 27, 2010
How do I go about to troubleshoot the failure of ldap server start on openSUSE 11.2? I added a custom configuration (through GUI) and now the server does not whant to start with that configuration.
View 1 Replies
View Related
Mar 21, 2010
I tried to install debian on my system using a small image at first that would download all the necessary components during the install. It loaded everything except Grub, and wont boot. I need to rescue this as the downloading of all the components took ages and I don't want to do that again.
View 1 Replies
View Related
Jul 11, 2011
I have an Ubuntu server running Couch Potato, Sick Beard and Sabnzbdplus. Everything "works" pretty well in a sense that CP and SB push the NZB's to Sabnzbdplus, but Sab crashes regularly (haven't found the solution or the cause for this problem, so if you have some advice regarding that, it's welcome).To counter this problem (Sab crashing) I have a script written which checks if Sab is runnning and if it isn't start it:
Code:
bart@Pyro:~$ cat CheckSabRunning.sh
#!/bin/sh
[code]....
View 9 Replies
View Related
Dec 27, 2010
From one day to the other my system stopped booting properly. Since I (finally) fixed it, I wanted to share my solution. It runs on a fakeraid pair of SSD's of 60 GB each (actually a single Revodrive device, but it shows up as two devices). When Ubuntu 10.10 boots, I'm dropped to a shell.During boot, when I removed "silent splash" from the kernel's command line, I got these messages:
Code:
[ 4.960240] scsi 6:0:0:0: Direct-Access ATA OCZ-REVODRIVE 1.20 PQ: 0 ANSI: 5
[ 4.960425] sd 6:0:0:0: [sdg] 117231408 512-byte logical blocks: (60.0 GB/55.8 GiB)
[cod]....
I doubt that this is what was needed (as I had that already when it didn't work, but I might be required in addition to installing dmraid)
# update-initramfs -a
After installing this, the problem was solved!! This is strange since I don't recall uninstalling this package or changing anything important, for that matter (perhaps did apt-get upgrade, but that's about it!). [URL]
View 2 Replies
View Related
Jun 30, 2011
I am trying to fix a perl script, and I really suck at perl. But I think this problem will be easy for people who know it.
The problem is, I have an old setup script someone wrote many years ago. It fails if the standard shell is dash and not bash. The only way I've gotten it to work is to point /bin/sh to bash. I looked thru the script and it uses "system" many places, and I think that's the problem.
I searched for it and found this link:url
My plan is to include this function:
Code:
sub system_bash {
my @args = ( "bash", "-c", shift );
system(@args);
}
Then I could simply change all calls to system into system_bash and it should work?
The parameter to the system calls is usually some variable. What if the parameter is a list already? Do I need to test for it somehow, and if it's a list, prepend "bash" and "-c" to the list? How do I do that?
In the script there are lots of places like this:
my $error = system($cmd);
if ($error) {
die/warn "some error message";
}
Shouldn't there be a return in the system_bash function?
View 8 Replies
View Related
Feb 16, 2011
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...
View 3 Replies
View Related
Jun 15, 2011
MACHINE: HP Proliant DL260G5OS: SLES 11 SP1kernel: Linux xserver 2.6.32.12-0.7-default #1 SMP 2010-05-20 11:14:20 +0200 x86_64 x86_64 x86_64 GNU/LinuxIt is used as remote xserver in a LAN.I have configured /usr/lib/restricted/bin/.rbashrc with some environment variables but when the users logon in the system finally is executed $HOME/.bashrc and some environment vars are overwritten.
View 2 Replies
View Related
Apr 27, 2011
I would like know when it is necessary or advisable to write a shell script instead of shell function ?
View 3 Replies
View Related
Feb 11, 2011
When I run my script(attachment) and I use an option(-l -u -r) that requires an argument, it should exit if the argument isn't supplied, but it doesn't. How do I arrange this?
View 1 Replies
View Related
Aug 19, 2010
I've a script that forks to another script.
The problem is that the child will not return to main process.
Main script "fork.sh"
Code:
The child process "smb_fork.sh"
Code:
when running it from the terminal "sh -x ./foork.sh"
Code:
My goal is via cron connect to ~100 remote winXP computers and download a single file. There fore I like to fork the process.
View 1 Replies
View Related