I have a simple .bashrc backup script I've been working on, but my external hard drive needs to be plugged in for it to work. So I set up a while loop, that exits after the hard drive has been plugged in and backed up. Here it is:
I've written a bash script to connect to each machine in our local network and update the fstab file to point certain NFS mounts to a new location.The script is meant to read in a list of shares and a list of workstations, rsync the relevant share then connect to each workstation and update the fstab file before moving onto the next share.In reality what is happening is it will perform the loop correctly for the first workstation in the list but will not move on to the next one. I'm really stumped on this and I'm sure it's something simple but I just can't seem to work out the answer!
I am querying a single string column in a table. The string values have spaces in them. I want to loop over each value in bash. I set IFS to split lists on newlines instead of spaces. When I try this, it is splitting the list of results on the actual character 'n', not the newline ''.
DATA=`mysql -u root -ppassword --silent 'SELECT name FROM table_a;'` IFS=$' ' for i in $DATA; do echo "item = $i"
So I was playing RollerCoaster Tycoon 2 in a WINE Virtual Desktop when I went to check my email. I launched Firefox and suddenly my bookmarks started to replicate and haven't stopped. I've recorded this happening. Link here: [URL]
I have a program that calls a program on a remote host via SSH in the background. In the command similar to the following:
But the problem is, this program stays infinitely in the background. Is there any method of implementation so that I can kill it? like after 10 seconds of trying?
I am trying to refrain from using TCPKeepAlive or sshd_config stuffs configurations. I was thinking of a fork() implementation where the parent sleeps for 10 seconds and then, if the child still haven responds to it, kill it.
I have 9.10 installed, grub has loaded and worked, now all of a sudden nothing will boot.The HP screen comes up and then the computer reboot, constant reboot cycle. Can't even get into the BIOS. It will just sit there if I hit escape. Won't boot the live cd either. What can I do??? It has worked fine for the past month now.
I'm using a EeePC 1000H and wanted to upgrade 8.10 to 10.10.[URL].. I chose to do a new install.
The following partitions are present:
- WindowsXP, 2 NTFS partitions - ext3 where 8.10 sits. It is of EasyPeasy-flavour (no other version available at that time) - hidden partition where WinPE resides
I downloaded the ISO and put it on a USB stick (4GB). Booting works fine. Using it as a live-system works fine as well. Problem came when I want to install it. The process hangs at "Preparing to install Ubuntu-Netbook" after clicking "forward". Nothing happens afterwards. In the menubar a crash-report detected-notification appears, saying: Quote:
The problem cannot be reported: The program crashed on an assertion failure, but the message could not be retrieved. Apport does not support reporting these crashes Unfortunately no other information available.[URL].. but not the same hardware. The thread there seens bot to be of much use anyway, therefore this new post.
I have a csv file (id, loc, timestamp, impressions) that I need to derive some low-level calculations from. Im ok with basic sort and grep operations, but this one is challenging my feeble scripting skills (normally I�d throw it into a spreadsheet, but in this case Id like to ultimately create a script that I could automate). Ive already used cat/sort to order the csv file first on location and then timestamp so it looks like this:
What Id like to do is output to file a record of the total, min, and max number of impressions for each location. , e.g.
AA6504 3231 AB252525 AC37925109 ZZ35512341
how to do this and Im kind of stuck on how to approach it I think the combined steps of looping through the locations along with the min/max/sum calculations are throwing me. Eventually Id also like to do additional calculations like average, ect. but I think I can figure that out on my own if I can just get this part down.
I've had openSUSE for a week. The update says that there are 10 updates. When I run it, first I get a flag saying that something can't be removed. Then when I run the rest of the up date, it loops back and starts over. I need a patch to fix the patch that fixes the patch that...etc.
I'm working on the Solaris environment and the DB i'm using is Oracle 10g. Skeleton of what I'm attempting; Write a ksh script to perform the following. I have no idea how to include my sql query within a shell script and loop through the statements. Have therefore given a jist of what I'm attempting, below.
1. Copy file to be processed (one file at a time, from a list of 10 files in the folder ).
Code:
for i in * do cp $i /home/temp
2 . Create a snapshot(n) table : Initialize n = 1
Code:
create table test insert account_no, balance from records_all; -- creates my snapshot table and inserts records in SQL
3. Checking if the table has been created successfully:
Code:
select count(*) from snapshot1 -- query out the number of records in the table -- always fixed, say at 400000
Code:
if( select count(*) from snapshot(n) = 400000 ) echo " table creation successful.. proceed to the next step " else echo " problem creating table, exiting the script .. "
4. If table creation is successful,
Code:
echo " select max(value) from results_all " -- printing the max value to console
Why, after a successful (I thought) dual boot installation w/ a side-by-side lynx and meerkat install and XP does my system refuse to boot? It just gets to the Dell screen, giving boot options (none of which are making any difference) and keeps looping it. Last night, after re-installing the grub (lost after the XP install) everything was working fine. I powered down and this morning tried to restart and...this. I really don't want to have to reinstall everything and reconfigure and reinstall apps--what can I do? And more importantly, WTF did this happen to begin with?
instead of importing a file I would like to use the variable $x I tried using pipes, but with no luck. My goal is to read one line at a time, but not have to export my data to another file, I would like to keep it all within one script.
I have an Excel Spreadsheet which reports upon weekly performance. One portion of the worksheet looks at week over week increases /decreases. I've placed a number of image controls (15 in Total) next to cells which calculate week over week change. The image controls simply display an image depending on whether the value of the adjacent cell is positive or negative. So, here is my basic working IF statement:
Code:
Private Sub Worksheet_Change(ByVal UpDown As Range) If Range("J26") > 0 And IsNumeric(Range("J26").Value) Then Image1.Picture = LoadPicture("C:path oup_arrow.gif") ElseIf Range("J26") < 0 And IsNumeric(Range("J26").Value) Then
[code]....
As you can see, this is pretty simple. What I'd like to do is find a way to loop through all 15 controls and avoid having 15 IF statements run on the Worksheet_Change() event. The cells containing the week over week values are all in the same column, but not continuous. Involved cells are: ("J26", "J27", "J33", "J34", "J35", "J36", "J37", "J38", "J39", "J40", "J42", "J43", "J44", "J45", "J46")
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.
I create a bash script that writes another bash file. But in the generated bash file I want to write a bash command in the file and not executing it.Here's my bash file:
Code: #!/bin/bash cat > ~/generateGridmix2data.sh << END
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!
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.
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?
I have searched and searched and maybe I don't know how to articulate this issue with out just posting the problem I'm having. Every time I bring up a terminal window I get the following "Header"
To be honest I cheated and used the .bashrc / .profile files from Ubuntu and all was working fine for a while now and it seems something changed to cause this... any ideas on why I am getting this? I checked my .bashrc and my /etc/profile and it doesn't look like anything is amiss..
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.
I've noticed something, and hoped there was a work around.when I write a simple bash script, and run it, if I close the terminal i ran the bash script inside, the bash script stops. What are the solutions for this? Basically I want to run my bash script and close the terminal, keep the bash script running.
What happens when the script executes is that the ssh connection works and parks me at the remote hosts's shell login. Therefore, the "firefox" command refuses to execute. I need to know how to make the "ssh" connection occur, stay open, and go into the background so that the rest of the script can execute.If I could also do this with the "firefox" line so that the entire term window could be closed would also be helpful.
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
On one of my servers I see this when I log in. What does this mean and how can I get it to go away? Everything seems to work fine, but none of my other machines give this error.
Code:$ bash To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. $ /bin/bash To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details.