Programming :: Bash Script With Ftp Session Exiting The Script Early?
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
ADVERTISEMENT
Jul 21, 2009
I am trying to setup a chroot with a sshd service running. when I start the sshd in the chroot and login I get this message. Can not find anything on google.
[damien@dev ~]$ ssh -l damien localhost -p 2233
damien@localhost's password:
Last login: Tue Jul 21 13:32:52 2009 from 127.0.0.1
debug3: PAM session not opened, exiting
Connection to localhost closed.
[Code]...
View 2 Replies
View Related
Nov 10, 2010
I have a very bad attempt at hashing the components of an tcp session to assign/locate the session in a hash table bucket. I am pretty sure that it has a very high collision rate and when there are a very large number of tcp sessions my application is having to search a long linked list to find the session within the bucket.
All the hashing functions I have found take a single string input where I need to input several integers and hash them into a single result. My guess is that any real hashing function is going to produce better results than what I am currently doing.
[Code]...
View 2 Replies
View Related
Oct 13, 2010
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.
View 3 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
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
Nov 12, 2010
Currently i'm doing a script for my project and I want to prevent people from exiting the terminal by clicking the "X" at the top right. when I run the script, user cannot exit out of the terminal unless the scipt finish running.
View 5 Replies
View Related
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
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
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
Feb 4, 2011
I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.
View 3 Replies
View Related
Jan 24, 2010
simple bash code:
Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do
[Code]...
How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!
View 10 Replies
View Related
Apr 5, 2011
I downloaded ubuntu for desktop and created an usb-stick. I am using an old hp eVectra PC as an "guinea-pig". I configured its bios to use usb as first boot device. It did not boot from there, but went straight on to the debian on the HD.Ok, let's go for a CD. I burnt the image and tried again.Meanwhile, I used this CD on an other PC - but not for an installation, but only for a trial run.
View 7 Replies
View Related
Nov 26, 2008
I have a config file that contains:
my.config:
Code:
Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.
Here is my parse_cmd script:
Code:
View 3 Replies
View Related
Jul 25, 2011
I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.
Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?
View 5 Replies
View Related
Apr 7, 2010
I'm obviously very stupid, but fedora is polite about it, suggesting it might be a bug. My laptop has 4Gig of am, twin turion. Of dev/sda1 - sda10 I give itsda5 = /boot (40/80M used)sda6 = / (Old fedora install 5G of 19G used)sda7 = /home (9G of 23G used)which is the previous arrangement on fedora 9. Next screen is about a boot loader, and it offers me sda1 or sda6. I tell it go go and play in the traffic and uncheck the box 'install boot loader' I hit 'next' and it crashes, muttering about some python assertation. It offers to save the error, and I say yes, but doesn't - it just saves some other crap.Any ideas, Fedora experts? I'm afraid I'm rusty on fedora, having defected to slackware & slamd64. But I am trying to get back.
View 7 Replies
View Related
Jan 9, 2010
I would like to get the filename (without extension) and the extension separately. The best solution I found so far is:
Let FILE="thefilenameofsomefilesfor_instance.txt"
Code:
NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`
I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.
View 5 Replies
View Related
Oct 7, 2010
I have a new problem tied to the same system as in [URL]Apparently when I send the output from
Code:
wget -q -O- http://<IP address>/<filename>.asp?LID=12345 |dos2unix
to /dev/ttyS0 (whether via > /dev/ttyS0 or via > <somefile> then cat somefile > /dev/ttyS0)
[code]....
View 9 Replies
View Related
Jun 14, 2010
i probably messed up the clock somehow... I think during install. Linux keeps messing up windows clock... And vice versa... When the clock in windows is correct (say, 2 PM), the clock in Linux when i reboot says 4 PM... And when i set up the clock in Linux to the correct time (in this case 2 PM) and boot into windows, windows clock says 12 PM...
Of course, when i correct it in windows, linux clock gets messed up again... 2 hours early or forward, idk... I'm not sure what i did to make this happen... Maybe has something to do with hardware clock... I don't wanna constantly correct time whenever i change systems...
View 7 Replies
View Related
Jul 16, 2010
I have a cronjob which is supposed to run every 15 minutes and record with arecord for 900 seconds. When I run the script manually, arecord record for 900 seconds, but when cron starts the script it stops recording after about 90-110 seconds.
Code:
rndusr@0x90:~/ralog$ cat rec.sh
#!/bin/bash
YEAR=$(date +"%Y")
mkdir /home/rndusr/ralog/data/$YEAR
[code]....
View 3 Replies
View Related
Apr 16, 2011
I'm very much interested in running Ubuntu (64bit) on the new 15" macbook pro (8,2), but I would like to get a bit more info about it. So if you own a 15" macbook pro.
Following questions:
1) Can you switch of the AMD Radeon GPU to save power?
2) Does the Thunderbolt port allow you to use an external monitor?
3) What is the battery life under Ubuntu? (describe your usage)
Some more 'advanced' questions:
4) Is the quadcore benificial for running full disk encryption (due to the extended AES in Intel's 2.2 i7 cpu)?
5) What kind of IO throughput do you get with and without full disk encryption (please describe if you use SSD or HD incl RPM)
6) Can you tell me the exact type of Broadcom wireless chip used for wifi?
View 4 Replies
View Related
Apr 21, 2011
I try to learn using session. I created sess1.php with the following code:
<?php
session_start();
// makes an array
[code]...
View 5 Replies
View Related
Jan 13, 2010
Im a fresher in PHP.Actually i wanted to know that whether there will be time delay while using session variables in PHP.By using some 10-20 session variables in my code will it affect the speed of the loading of the page.If so then can u suuggest any other method to pass the varaibles which will not slow down the speed?
View 4 Replies
View Related
Apr 23, 2011
I have done some tcp stream multiplexer. I'm using it as independent login proxy (user is once authenticated and then switched to hidden device (cisco)). But I need to reset session (no connection) configuration, because cisco supports xterm, ctr-c, etc... Am I able to do? Just restart negotiation? Using IAC codes?
View 2 Replies
View Related
May 21, 2011
I need a way to have screen (or dbus, whatever) to spit out a list of windows (title and number) that are active in a screen session.I'm writing a wrapper for common work tasks. Part of the functionality will check if a certain window exists, and if so let me know. The idea here is to prevent accessing the same machine twice. (although, and override option would probably be needed, just in case, but I digress...) I've searched through the screen man page and don't see anything that'll work. I'm not beyond forking screen and ending up with a custom version. However, I'd like to avoid that if I can.
Edit: I'd like to see something like "screen -S screen_name -window-list" or similar.
View 6 Replies
View Related
Oct 4, 2009
Page.php -- has a special division thats empty and on Link Click calls Javascript to change inner.html to an IFRAME call So the user clicks the link and then it shows the division and loads the IFRAME The IFRAME Source is iframe.php in IFRAME.PHP I need to take the Session Variables that were set already in Page.php all sessions work fine when not using Iframe (open iframe.php in its own window) but doesnt work when its Iframed and sadly I have to use Iframe on this page NOW the CATCH is -- I CANNOT use any POST or GET Values the iframe src MUST be straight url to the page [URL] cannot use variables in the url [URL] etc..
IS it possible to do what I need Without passing variables via the url? Page1 has all session variables set, calls the iframe command when users presses a button, Iframe loads but DOES not have the Session data that was saved on Page1 -- and IFRAME cannot pass variables via the URL it must be a direct url to the page only Page1.php java used to set the HTML / IFRAME into its Div
Code:
<script>
function changeText(){
document.getElementById('iframediv').innerHTML = "<iframe scrolling='no' frameborder='0' margin='0' src='http://mypage.blah/iframe.php'></iframe>";
[code]....
View 2 Replies
View Related
Mar 31, 2011
I need to rename the resulted searched files from a loopI have the following code:
find . -name DOC* | while read i
do
find $i -type f -name '*.txt'
done
basically, I am searching for all txt files inside any folder starting with DOC name.this code is working fine with me.I need to rename those .txt files to .txtOLDOS: Ubuntu 10.4Bash shell
View 10 Replies
View Related
Oct 27, 2010
Is any way to detect a keypress event in a console session? Preferebly without needing the application to be running in the foreground
View 2 Replies
View Related
Jan 29, 2011
I am trying to write a bash script that sources another bash script. Essentially, I need a few lines to check to see if a certain variable is set. If not, I set it manually, and then source a scripts with that variable in the path. I wrote a test script to try it, but for some reason the last line does not work. Here is what I wrote:
#!/bin/sh
source ~setupdir/setup.shrc #just a test, this line works
echo ${#SETUP} # prints 0 if setup is not set, which it isn't
if [ ${#SETUP} -eq 0 ]
then
SETUP="~setupdir"
fi
echo $SETUP # prints ~setupdir
[Code]...
View 5 Replies
View Related
Apr 1, 2009
Want to return current LINES=, tryng to avoid the "hacky" backticks and string manipulation way
ie: my $somevar = `set | grep LINES`
I tried using the env command and it returns a empty value?
my $lines = $ENV{'LINES'};
$= doesnt work well for putty sessions...
my $lines = $=;
View 6 Replies
View Related