General :: CentOS 5.4 - Bash Script Exits SU Or SSH Session
Apr 23, 2010
I am using CentOS 5.4. I created a bash script that does some checking before running any commands. If the check fails, it will simply exit 0. The problem I am having is that on our server, the script will exit the su or ssh session when the exit 0 is called.
#!/bin/bash
# check if directory has contents and exit if none
if [ -z "`ls /ebs_raid/import/*.txt 2>/dev/null`" ]; then
echo "ok"
exit 0
fi
Here is the output:
[root@ip-10-251-86-31 ebs_raid]# . test.sh
ok
[russ@ip-10-251-86-31 ebs_raid]$
I was removed from my sudo session, if I wasn't in the sudo session, it would have logged me out of my ssh session. I am not sure what I am doing wrong here or where to start.
View 1 Replies
ADVERTISEMENT
Sep 1, 2011
I'm planning on writing a BASH script for my website's server that will process data from user input via HTML forms, and then write data to the website's HTML documents. My question regards how to deal with the possibility that two users send form information very close to the same time, thus having the BASH script being called again while the first instance of the script has not yet finished.
I don't even know what happens in general when a BASH script is called while it is still running. Even if that is ok, and a new, separate script process is started (or whatever really happens), how am I supposed to prevent issues that could come from two different instances of the script trying to write to the same file at the same time? Is there a way to force the BASH script to finish its work before launching again, in the event of multiple requests?
View 6 Replies
View Related
Apr 25, 2011
how to launch a non-login bash session that doesn't inherit its parents environmental variables, and doesn't source /etc/bashrc?
View 2 Replies
View Related
Jun 20, 2011
I'm trying to execute some code (let's call it login.java) when I log in and out of my linux machine. Is there any way to do this? I'm looking for perhaps a way to trigger the code? I've thought of just putting it in my .bash_login but preferably the code would launch on normal login, not when I start my terminal.
View 2 Replies
View Related
Aug 17, 2010
I'm learning Bash and can't find how to say "if file1 exists and file2 exits then...".I thought this may work:
Code:
file1="/root/file1"
file2="/root/file2"
[code]....
View 5 Replies
View Related
Jan 22, 2010
I am putting together some new systems for my customer and I'm having some trouble with a script that we use to back up files to a DVD R. The problem is that I can't write a 2nd session to the DVD unless I eject the disk and reload it. The drives are slimline type drives, Sony BD-5730S and Teac DV-W28S-V93, so they won't reload without human intervention. Opsys is CentOS 5.4 or RHEL 5.4. I've tried both AMD and Intel based mother boards. If i try this on Fedora 11 or 12 it works fine. This works on IDE attached drives but not a SATA attached drives. Fedora appears to use something called genisoimage instead of mkisofs. I can't get genisoimage to run on CentOS or RHEL.
Here's the code to setup the test files:
rm -f /tmp/BDtest/*
mkdir /tmp/BDtest
dd if=/dev/zero of=/tmp/BDtest/blank.iso bs=10M count=1
for NUM in {1..160}
[Code].....
View 2 Replies
View Related
Jan 25, 2011
Quote:
logcountfunction()
{
awk ' {
# when executing the script pass the logfile as parameter on the command prompt with the name of the file
#export file_name= "&1"
[Code]....
my problem is that when i execute this script only the first two functions are being called.once the DBcounttry_finalnofunc() is done ,the script exits.The rest of the functions are not being called.
View 1 Replies
View Related
Mar 28, 2011
I have disabled root ssh logins for security. When I am logged in as a normal user over SSH and do a su into root the tab-completion stops working with apt. It still works when doing normal file-browsing, on the original user1, and it has worked previously when logged directly into root. How do I make it autocomplete again? I am using Debian Stable on a headless homeserver.
View 3 Replies
View Related
Mar 17, 2010
I faced a issue with updating a file contents with echo command which fails with error as below:
echo "foo" > bar //to create a file named "bar"
echo "foobar" > bar //to edit its contents
The latter fails, it prompts "File exists" i.e.
~>echo "foo" > bar
~>echo "foobar" > bar
bar: File exists.
~>cat bar
foo
~>
View 4 Replies
View Related
Oct 7, 2010
I'm running GNU Emacs 23.1.1 on "Ubuntu 10.04.1 LTS" and any search I perform using the built-in M-x rgrep on the standard Linux kernel source code (vanilla) ends prematurely with the following error printed to the emacs echo area:Grep exited abnormally with code 123.I have been seeing it for a while on Redhat systems as well, and with other (large) code bases.
View 2 Replies
View Related
Jul 28, 2010
I am trying to write a bash script to open 1 screen session with multiple windows... each one running a different service. Is this possible? I tried several things, and I can start up multiple sessions really easy.. but not 1 session with multiple windows...
I want this so I can attach to that session and quickly move between the different windows.
View 4 Replies
View Related
Nov 25, 2010
I am a newbie in linux. I tried to write an autorun bash script on /root and select System-Preferences-More Preferences-Sessions-Startup Programs-Add.But the bash script seems like not working. Following is my bash script:
#!/bin/bash
#
#chkconfig:345 99 99
[code]...
View 8 Replies
View Related
Aug 30, 2010
I have a bash script that launches an application of mine through a gnome terminal with the following command:gnome-terminal -x MyApplicationIf MyApplication launches correctly, a GUI is displayed. If it fails to launch correctly, it reports errors to stdout (the terminal).
My problem is, the terminal immediately exits when MyApplication exits, leaving no time to see the error messages if MyApplication fails to launch.You can also see this behavior by trying:gnome-terminal -x lsThe gnome terminal immediately exits.Is there a way to stop this behavior? I want the terminal to remain until I close it.
View 6 Replies
View Related
May 11, 2010
Info about session timeout.
I use tmout = 15 min in my /etc/profile (along with readonly tmout). i have some issues i need to address, looking for ideas.
1. what is considered a idle "session" ?
2. if i & a process to the background and do nothing is this a idle session?
3. if user uses su to a higher level, are there now two sessions? is the tmout for user suspended until su user time outs or leaves su session?
4. i have some users who will run long sql queries. is there a workaround to have the session remain active until process has finished?
View 3 Replies
View Related
May 6, 2010
I have to run a graphical session for using something with wine on a server (unfortunately :((( ) and I'd like to run a TWM session. As I would like to lock the session, I settled things to log on from XDM. However, I can't find anyway to lock the session. Is it possible (I guess yes) ? How can it be achieved?
View 3 Replies
View Related
Jan 5, 2011
not have shell in VNC session ,
on a clean install of centos put these command
yum update -y
yum groupinstall -y "Japanese Support"
yum install -y rtorrent lftp mc firefox
yum -y groupinstall xfce
[Code]....
View 4 Replies
View Related
Feb 22, 2010
I got this script that backs up a server and then keeps only the last 10 backups and removes the rest.Problem is, the part where it deletes any backups older than the last 10, it never reaches that. I'm guessing it is because the ftp session somehow exits the script entirely, especially if there is a problem with the ftp session. But just to make sure, I'm wondering if you all can look at the code to see if I am making it exit accidentally.Here's the code. I left out data like ip address and directory/file names for my security purposes.
Code:
#ftp in and grab the file
ftp -in xx.xx.xx.xx << EOF
[code]...
View 5 Replies
View Related
Jan 12, 2010
I can't start a Remote-Session and I'm looking to the log-files at the moment. Where are the logfiles for NX?
I found, but here is nothing inside:
/var/log/nxserver.log [root@headnode1 ~]# cat /var/log/nxserver.log [root@headnode1 ~]#
View 4 Replies
View Related
Jul 22, 2010
is there a way to kill a pts/* or tty* user session from comman line, without knowing its process id.
View 1 Replies
View Related
Dec 31, 2010
My server (CentOS 5.5) is a ldap client authenticate to LDAP server (Successfully authenticate) I use pam for ssh. I can ssh successfully with any users on system. But I cannot su - from ssh. It display the error: Could not open session. I look to log file and it shows: # tail -f /var/log/secure
View 5 Replies
View Related
Jun 4, 2011
I am facing problem on executing commands like df -h,ls-l,grep etc in /bin.
it is showing below errors:--
----------------------------------------------------------------------------------
login as: root
root@220.226.102.217's password:
Last login: Sat Jun 4 11:14:20 2011 from 220.227.54.149
-bash: /bin/egrep: cannot execute binary file
[code]....
View 2 Replies
View Related
Apr 5, 2009
I am new to CentOS and need this urgent help.
On my machine, I am not able to login using any of the user account or root. It's showing this message:
Then comes another message:
YOur session lasted for less than 10 seconds. Try logging using Failsfe.
....
session_child_run: Could not exec /etc/X11/xinit/Xsession default
I tried to use the failsafe as well, but nothing seems to work.
Would someone please help me regarding this issue?
View 1 Replies
View Related
Jun 8, 2009
Session management with gnome-session-properties and GDM appears to be broken in CentOS 5.3 and 5.2. I can't comment on earlier versions.Activating "Automatically save changes to session" does work--for example, on the next login, the terminals that were open at the last logout are reopened.
But if "Automatically save changes to session" is not selected, according to help,"when you end your session the Logout Confirmation dialog displays a Save current setup option."This does not happen. No "Save current setup" is offered, regardless of whether or not "Ask on logout" is selected.
Also according to help, if one has added sessions with gnome-session-properties, then
when one logs in "on GDM, you choose a session. When you choose a session, you can
select which of the multiple sessions to use."This does not happen. No matter how many sessions one may have added with gnome-session-properties, none of them appears in the list of sessions that GDM presents.
So it appears that only a small fraction of session management functionality works in
CentOS 5.3 and 5.2.
View 1 Replies
View Related
Sep 29, 2009
I have a CentOS 5.3 server, running in a VM. I get the iSCSI session to my Buffalo, but the disk doesn't appear.
Sep 29 09:06:29 qaservice iscsid: iscsid shutting down.
Sep 29 09:06:29 qaservice kernel: Loading iSCSI transport class v2.0-871.
Sep 29 09:06:29 qaservice kernel: iscsi: registered transport (tcp)
Sep 29 09:06:29 qaservice kernel: iscsi: registered transport (iser)
[Code].....
View 2 Replies
View Related
Sep 2, 2010
I have 2 servers, I set the first one up so that I can remote to it and connect with VNC over ssh by following:[URL]ServerThe 2nd server I did the same, but I cannot connect! When I do, vncviewer prompts for a password and then opens a window of the correct size, but it is all white and then my ssh session is locked! I can't enter any more commands, I have to kill the session.
View 3 Replies
View Related
Oct 29, 2010
I have centos 5.5 like a OS in my computer, and i wana add a arabic language in the frensh session, i mean i wana list the arabic site in the frensh session.
View 3 Replies
View Related
Jul 19, 2011
I am running matlab 2010b on centOS5.6. Matlab opened without any error either in the computer terminal or in VNCSERVER. While running bench (of matlab) the session or the vncserver are crashing.In some cases the bench run for the first time without any problems, however it will crash the session or the vncserver on the 2-3 runs of the same code.
View 5 Replies
View Related
Jul 12, 2010
I will describe the steps that produce the error:
0.My home directory is leon
1.Open KDE Help Center
2.Go to Search Tab
3.Application Manual Index Status OK
4.Select Application Manual Index
5.Write the search term "lskat" and press Search button
6.Click on the only result
The following message box appears: The file or folder help:file:///home/leon/.kde4/share/apps/khelpcenter/index/kde_application_manuals.tmp/index.html
does not exits
Also in the main window of khelpcenter the following message appears: There is no documentation available for /file:/home/leon/.kde4/share/apps/khelpcenter/index/kde_application_manuals.tmp/index.html
View 4 Replies
View Related
May 9, 2009
I installed squid 2.7 and want to use squid_session external acl rule. But there is no squid_session in any dir, looked everywhere. On my Ubuntu box I also have squid 2.7 and there I have squid_session.
View 4 Replies
View Related
Mar 19, 2010
2.6.18-164.11.1.el5 x86_64 x86_64
centos-release-5-4.el5.centos.1
I have been updating my system and making a few changes and now I have a serious problem with GNOME (as far a I understand). In the Desktop if I try to start some applications such as the text editor gedit it crashes and won't start. Some applictions start from the menu some don't (e.g. services) and others start and then crash if I try to example manipulate them (e.g. open a file in openoffice).
In the case of gedit if I try to run it from the command line as root I get the following
# gedit
(gedit:6475): GnomeUI-WARNING **: While connecting to session manager: Authentication Rejected, reason : None of the authentication protocols specified are supported and host-based authentication failed.Illegal instruction [code]....
When I try to start the services (i.e. /usr/bin/system-config-services) I get:
Mar 20 00:35:54 ##### kernel: system-config-s[6536] trap invalid opcode rip:3e18ffd008 rsp:7fffeeffdb30 error:0
in /var/log/messages
View 8 Replies
View Related