Programming :: Bash: Speeding Up A Script?

Jan 17, 2011

the bash script we're using to index the music takes FOREVER. A copy of the script is below. We need it to update the database daily, but using find even with the new files added takes over 6 hours.

Code:

#!/bin/bash
mv /var/www/music/index.hold /var/www/music/index.html
before=$(date +%s)
tdy=$(date +%u)

[code]....

View 14 Replies


ADVERTISEMENT

Programming :: Bash: Printing The Line Number In Bash Script?

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

Programming :: Bash Ctrl+c Tarp And Bash Read With Timeout?

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

Programming :: Reading A Bash Variable In Bash Scripting ?

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

Programming :: Run Multiple Bash And Php Scripts From A Bash Script?

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

OpenSUSE :: Speeding Up Printing ?

May 20, 2010

opensuse v11.2 linux 2.6.31.12-0.2-desktop x86_64

We have a networked Kyocera cs-3050 printer. When I print something to it, the Print window hangs for about a minute while the printer process queries the printer. This would be acceptable if it did happen EVERY TIME I printed a document.

Is there some way to have the printer driver cache the information instead of asking for it every time?

View 9 Replies View Related

Programming :: Bash: Get Filename And Extension Using Bash?

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

Ubuntu :: Speeding Up Firefox With A Slow SSD?

May 26, 2010

I have an Acer Aspire One A110 netbook. Presently, it runs Ubuntu Netbook Remix 9.10 and Firefox 3.5.8. The A110 is an early model with a slow SSD (solid state drive). Firefox was slow and often paused (froze for a moment). I tried several hacks in the Ubuntu forums and elsewhere to speed up Firefox. Some were not effective at all, some were very technical and at least one produced instability. I tried Google Chrome, which started out fast but turned slow. Emptying browser caches did not fix my problems.

I thought the slow disk must be the problem and moved the browser cache to a dedicated SDHC card. I've since been running with a dedicated cache for a month or two now, have never emptied the cache and Firefox still runs fast. I mean fast enough that it doesn't slow down my browsing (I'm not trying to set world speed records).

The A110 has two SD slots. I have a 16 GB SDHC card in the 'Storage Expansion', which is my data disk. The second is a card reader slot. I didn't want to mess with my data disk. I bought a fast (Transcend, Class 6)

4 GB SDHC, put that in the card reader slot and set up my Firefox cache there:

1. Type about:config in the Firefox address bar.

2. Tell Firefox where your new cache is. For me:browser.cache.disk.enable true.

browser.cache.disk.parent_directory /media/BD2C-8BD5/firefox (I created a directory /firefox on the card)

3. Tell Firefox to increase the size of the cache: browser.cache.disk.capacity 512000 (formerly 51200)

4. Check the cache is enabled, type about:cache in the Firefox address bar. For me it returns: /media/BD2C-8BD5/firefox/Cache

To get the name of the cache directory easily and accurately, open this directory with the File Browser, toggle to a text-based location bar and there it is. Cheap SD cards can be purchased on feebay. Select carefully, they're not all fakes. SDHC Class 6 is fine for a browser cache, handling small blocks of data. Cards only slow down when you do a massive file transfer. 2GB or 1GB should be adequate but fast and small cards are rare. Other memory cards can be used of course, but speeds vary between different technologies.

View 2 Replies View Related

Ubuntu :: 10.10 ... Speeding Up Boot Time

Dec 18, 2010

I'm using Maverick, and I'd like to know some ways that I can make my laptop boot faster. I put the image for the bootchart on my website, just click on the picture and then zoom into it. [URL]

View 3 Replies View Related

Ubuntu :: Speeding Up Flash In Firefox (11.04)?

Jul 13, 2011

Does anyone know any way to speed up flash in firefox on 11.04.I get a lot of lag trying to play games.

View 6 Replies View Related

Slackware :: 13.1 Speeding Up Boot Time?

Jul 19, 2010

Just some things I changed to speed up the boot time.

In '/etc/rc.d/'

rc.acpid
Code:
echo "Starting ACPI daemon: /usr/sbin/acpid &"
/usr/sbin/acpid &
rc.hald

[Code]....

View 14 Replies View Related

Ubuntu :: Fan Keeps Speeding On Dell Studio 1747 10.04?

Sep 5, 2010

I recently bought Dell Studio 1747 with i7 processor. My fan keeps running fast and does not slow even when the load on processor is low or idle. In pre-installed Windows 7, fan works perfectly increasing and decreasing speed based on work load. The noise made by the fan is irritating.

View 1 Replies View Related

Ubuntu :: Slow To Load In Nautilus - Speeding Up?

Mar 7, 2011

Folders with large collections of photos are incredibly slow to load in Nautilus. Sometimes Nautilus goes grey and never recovers. I've tried increasing the size of the thumbs cache but that doesn't seem to make a difference. Ubuntu's Nautilus is also several times slower than Fedora on the same computer and same folders (Multiple OS). I've gotten so that I mainly use Thunar, which loads the same folders in a fraction of a second, though Thunar comes with its own limitations. Is there a way, yet, to make Nautilus behave like Thunar.

View 3 Replies View Related

General :: Speeding Up Script By Opening And Closing DB Connection Just Once?

Jan 21, 2011

I have a script which takes a file as input and reads it in while loop cuts the name of table and stores in a variable opens DB connection and queries for rowcount in that table closes the connection reads another file and then follows step 1 through 4 till EOF is reached. Now this script is taking longer to execute maybe because the DB connection is opened and closed each time.

My scripts is:

Code:

#!/bin/ksh
cat logcountOP | while read LINE
TBLName=`echo $LINE|cut -d "-" -f1`

[code].....

I was thinking of changing this.I want to open the DB connection just once and then query it for all tables and then exit.

View 3 Replies View Related

Server :: Squid3 Transparent Mode Not Speeding Up Internet?

Apr 3, 2010

I've setup Squid3 running on Ubuntu 9.04 64-bit server, and configured it to act as a transparent proxy and setup my router following these instructions: [URL]

Everything works great as far as browsing, but my main goal was to cache large downloads (usually executables) that I download frequently. So I set the minimum to 300KB and the max to 100MB. The problem, though, is the cache is not being used. I can download a file at regular speed on one computer, and then try and download it again and it downloads from the internet again, rather than the cache, so the speed is no faster.

Here's my config file:

Code:
#Recommended minimum configuration:
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8

[Code].....

View 1 Replies View Related

Programming :: Bash Programming - Rename Files In A Loop?

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

Programming :: Write A Bash Script That Sources Another Bash Script?

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

Programming :: Bash Scripting To Programming?

Jul 13, 2011

i'm in the process of learing C++. currently i'm creating shell scripts to get things done. i'm just curious how, as a programmer using C++ you would get a similar job done.as an example i have a script that takes the contents of files, pipes it to some sed and awk commands, which is piped to create a new file. that file is then imported into a mysql database.if you were going to do this in C++, would you call the sed/awk programs to modify the file, or can it be done within the program itself? i'm probably jumping the gun here because i've just started learing about pointers so this is above my ability

View 12 Replies View Related

Programming :: Sed A Variable In Bash?

Mar 25, 2011

I have beat this enough and don't get what should have been a very simple thing to do. I build a variable;

Code:
CLIST=java,lua,python,php,perl,ruby,tcl
CLIST will be used by another bash script but I need to replace the commas with a space. I

[code]...

View 2 Replies View Related

Programming :: Bash Script HELP - Hex To Dec ?

Dec 4, 2010

Creating script that converts hex to dec. But without using bc calculator or other methods that could convert it in one line. I need to make something like this script that converts dec to hex.

View 1 Replies View Related

Programming :: Can Use Bash Within An Awk Script

Apr 14, 2011

I have a basic awk script that can read a file named 'server_info' and output to the screen which fax lines are not working. Now I want to make the script execute commands instead of printing to the screen but I am having trouble... This is better explained by my code below:

test.sh Code: #!/usr/bin/awk -f
#
#The name of this script is test.sh

[code]....

View 1 Replies View Related

Programming :: Bash Command From PHP?

Jul 14, 2011

Distro: Centos 5, PHP 5I have done a bit research on running bash commands from php and there was little success. This is my relevant php script

<?php
echo exec('pwd');
?>

[code]...

View 16 Replies View Related

Programming :: Bash Function Using If / Then And Else

May 2, 2011

I am trying to build a function inside a script.

Code:
#!/bin/sh
#System commands and other configurable.
IPT=/sbin/iptables
IP6T=/sbin/ip6tables
IPST=/usr/sbin/ipset
MODP=/sbin/modprobe
GET=/usr/bin/wget
INT_NET=192.168.1.0/24 .....

I can find lots of tutorials in how to use if, then, else. However, how do I define a variable inside the function?
SEE>>
Code:
for c in $ISO
Also, am I using the 'test' command correctly( -/+ week as valid test)?

View 7 Replies View Related

Programming :: Bash IF Using IP Subnets?

Feb 14, 2011

I'm somewhere between Novice and I have no idea what I'm doing with bash scripts. I'm writing a script to deploy images using partimage on my company's desktops, and while I have just about everything else figured out I have one issue left.Each of our 4 sites that will be using this disc will have a deployment server due to the fact that our sites have dedicated point to point links that our business traffic is conducted on. I need to be able to determine what site I'm at based onubnet and set a variable based on this determination. What I don't know is how to get the IP address in to an if statement, and properly determine subnet. For example:

192.168.1.0/16 - 192.168.7.0/16 need to use DEPLSERV01
192.168.8.0/16 - 192.168.16.0/16 use DEPLSERV02
192.168.17.0/16 - 192.168.24.0/16 use DEPLSERV03

View 1 Replies View Related

Programming :: Difference Between /bin/bash And /bin/sh?

Dec 27, 2008

I know it's a very silly question but could someone please explain the difference between "/bin/bash" & "/bin/sh" I was under the impression that both are same but following output on my Ubuntu 8.10 is making me raise my eyebrows.

Quote:

parag@station3:~$ ls -l /bin/bash ; ls -l /bin/sh
-rwxr-xr-x 1 root root 725136 2008-05-13 00:18 /bin/bash
lrwxrwxrwx 1 root root 4 2008-12-03 21:42 /bin/sh -> dash
parag@station3:~$

View 11 Replies View Related

Programming :: Run Bash Script On Web?

Apr 9, 2010

i want to run bash script on website.i still have to choose between unix hosting and windows hosting. my web hosting service offer Own Cgi - Bin PHP,ASP,MYSQL,MSSQL, and script schedule(cronejob). This is script

#!/bin/bash
#Store arguments from bash command line
fight=$1
support=$2
msg=rmsg

[Code]....

View 2 Replies View Related

Programming :: Using Eval In Bash?

Nov 23, 2010

Having a problem with an unwanted redirection in in a function call. Although this isn't the function it does illustrate the problem:

Code:
#!/bin/bash
doat () {
ALL="sys1 sys2"
for Sys in $ALL;do
echo "---> $Sys <---";
echo $(eval echo $1);

[Code]...

figure out how to get the variable into the command without outputting to the file in the eval statement? So that ssh line that gets executed would look like the following to each iteration of the for loop:

Code:
ssh root@$Sys rpm -qa|sort > /trans/${Sys}-rpm-list.txt;
doat works when the incoming argument doesn't have any redirection in the command.

View 3 Replies View Related

Programming :: Using Gambas With Bash?

Jun 8, 2010

Is it possible to use Gambas as a GUI to read text string variables that are input by a user, and use the variables in a bash command?

I know how to do this simply with bash, but I want a GUI that little kids can easily use.

View 2 Replies View Related

Programming :: Variable Substitution In BASH?

Feb 17, 2011

Just a simple BASH for loop to read the file path from a text file (clean.txt) echo the variable for debug purposes, and scp it to a server I have using port 50 for SSH.

I've already formatted the entries in clean.txt to handle spaces correctly, using sed replacement.

Example from the clean.txt file:

Code:
/MP3/NAS000000001/Barenaked Ladies/Barenaked Ladies - Barenaked For The Holidays/20 Auld Lang Syne.mp3
/MP3/NAS000000001/Barenaked Ladies/Barenaked Ladies - Barenaked For The Holidays/14 Deck the Stills.mp3

[Code]....

View 5 Replies View Related

Programming :: Bash: Capture All Output To A Log?

Jun 10, 2010

I have a script that generates a bunch of output, including the expansions details provided by: set -v -xI am trying to pipe everything that is displayed to a file, in addition to displaying it on the screen. I've managed to get stderr and stdout into the file, but the expansions are only printed to the screen. Here is what I have so far:sudo -u <user> source my_job.sh |tee my_log.txt 2>&1

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved