Script to update your mirrorlist based on up2date mirrors

I got tired of manually updating my mirrorlist file so I wrote a small script today to update my mirrorlist, you might find it useful as well:
NOTE: I assume ZERO responsibility whatsoever for any harm caused by this script and by using it you agree to these terms and conditions. The script assumes you are based in the US, if you are in another country, adjust your URL below.
#!/bin/bash
# Define tmpfile
tmpfile=/tmp/mirrorlisttmp
# Determine architecture type
archtype=$(uname -m)
# Get latest mirror list and save to tmpfile
wget -O $tmpfile "http://www.archlinux.org/mirrorlist/?country=United+States&protocol=ftp&protocol \
=http&ip_version=4&use_mirror_status=on" >/dev/null 2>&1
# Wrangle txt in saved file
sed -i -e "s/^#Server/Server/g" -e "s/\$arch/"$archtype"/g" $tmpfile
# Backup and replace current mirrorlist file
if [[ ! -f /etc/pacman.d/mirrorlist.orig ]]; then
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig && echo "Successfully backed up original mirrorlist!"
cp $tmpfile /etc/pacman.d/mirrorlist && echo "Successfully applied new mirrorlist!"
else
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak && echo "Successfully backed up current mirrorlist!"
cp $tmpfile /etc/pacman.d/mirrorlist && echo "Successfully applied new mirrorlist!"
fi
exit
NOTE: You will need to copy the text above, place it into a file (call it updatemirrors.sh), run chmod +x on the file and then run it with sudo/root privileges.
Last edited by Archieman (2011-06-01 01:03:22)

karol wrote:
You can use [ code ] tags when pasting code https://bbs.archlinux.org/help.php#bbcode
For it to really auto-update the mirrorlist it has to be put in a cronjob :-)
If I run it twice, will the original mirrorlist (moved to mirrorlist.bak after the first run) be irrevocably lost?
Just nitpicking: you don't have to use 'g' for global changes in the sed substitutions as there is only one occurrence per line.
Thanks Karol - I made the adjustments above to address both comments. The 'g' for sed I think is OK to leave in :-)
Last edited by Archieman (2011-05-31 04:00:55)

Similar Messages

  • Mlopt, a script to keep your servers updated

    Hi everybody this is my first post.
    I was tired of having to check and see if the mirrors are %100 complete, so I wrote this.
    #!/usr/bin/env python2
    #Sort by speed
    #Then sort by score
    #It will never append incomplete servers
    #Will exit at the first sign of no internet, (saves CPU)
    #sudo crontab -eu root
    #@hourly /usr/bin/mlopt
    import urllib2
    import json
    import os
    from time import gmtime, strftime
    server_info = {}
    curr_servers = []
    arch = "$repo/os/x86_64"
    os.system("rankmirrors -n 5 /etc/pacman.d/mirrorlist.mlchk > /etc/pacman.d/mirrorlist.fast")
    try:
    mirrorlist = open("/etc/pacman.d/mirrorlist.fast").read().split("\n")
    except:
    exit(1)
    for line in mirrorlist:
    if line.startswith("#") or line == "":
    continue
    try:
    t = line.split("Server = ")[-1]
    curr_servers.append(t.split("/")[0] + "//" + t.split("/")[1] + t.split("/")[2])
    except:
    os.system('notify-send "Mirror-Update" "There is a error in your mirrorlist"')
    exit(1)
    try:
    page = json.loads(urllib2.urlopen("http://www.archlinux.org/mirrors/status/json/").read())
    except:
    exit(1)
    for segment in page['urls']:
    for server in curr_servers:
    if segment['url'].startswith(server): #Hax
    if segment['completion_pct'] != 1.0: #Dont even append if its not %100
    continue
    else:
    server_info["%s%s" % (segment['url'], arch)] = segment['score']
    try:
    new_list = open("/etc/pacman.d/mirrorlist", "w")
    new_list.write("#"+strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime())+"\n")
    new_list.write("#Generated by mirror-list\n")
    except:
    exit(1)
    for key, value in sorted(server_info.iteritems(), key=lambda (k,v): (v,k)): #http://www.saltycrane.com/blog/2007/09/how-to-sort-python-dictionary-by-keys/
    new_list.write("Server = %s\n" % (key))
    os.system('notify-send "Mirror-Update" "Mirrorlist updated"')
    You will have to make a "/etc/pacman.d/mirrorlist.mlchk" which it will read from and generate a new list called "/etc/pacman.d/mirrorlist.fast".
    Just run "sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.mlchk"
    It will sort them by score and create your new "/etc/pacman.d/mirrorlist". (It will not append the server if it not %100 complete)
    I have mine under /usr/bin/mlopt
    You will need the rankmirrors bash script and Python2.6.
    Last edited by stealthy (2011-05-13 17:18:04)

    An empty mirrorlist.mlchk will produce an empty mirrorlist (which will leave you unable to get new packages including pacman-mirrorlist).
    Also, your script explicitly names the architecture in the mirrorlist file. Afaik it should just be $arch.
    But it works and it's very handy, so thanks!
    Regards,
    mikar
    Last edited by demian (2011-05-13 17:32:39)

  • Pacman update and mirrorlist

    With the upgrade to pacman-3.2.1-2, we have split the mirrorlist into the pacman-mirrorlist package. This will allow us to push more frequent updates to the mirrorlist, instead of only updating it with pacman releases.  As part of this upgrade, your current /etc/pacman.d/mirrorlist file will be saved as mirrorlist.pacorig and the default mirrorlist put in its place.  Remember to merge these files in order to keep using your mirror(s) of choice.

    This is somewhat less generic than what I had in mind because I realized that the order of the mirrors need to be preserved. Anyway, the script does the following:
    read in uncommented mirrors from mirrorlist.pacorig
    check them against the new mirrorlist
    for each one that's not in the new list, ask if the user would like to keep it
    create a new file with the previously selected mirrors appended to the top followed by the complete new mirrorlist with the server lines commented out
    usage:
    merge_pacorig_mirrors.pl /path/to/output_file
    Check the output file then move it to /etc/pacman.d/mirrorlist if you're happy with it. The script will not overwrite your mirrorlists (unless you specify them as the output file, but I do not recommend that).
    #!/usr/bin/perl
    use strict;
    use warnings;
    sub read_file
    my $file = shift;
    my $text;
    open(my $fh,'<',$file) or die "unable to open $file: $!\n";
    local $/;
    $text = <$fh>;
    close $fh;
    return $text;
    sub save_file
    my ($file,$text) = @_;
    open(my $fh,'>',$file) or die "unable to open $file: $!\n";
    print $fh $text;
    close $fh;
    sub confirm
    my ($question,$default_answer) = @_;
    print "$question ";
    if (defined($default_answer) and $default_answer eq 'y')
    print '[Y/n] ';
    elsif (defined($default_answer) and $default_answer eq 'n')
    print '[y/N] ';
    else
    print '[y/n] ';
    my $answer = lc(<STDIN>);
    chomp $answer;
    $answer = $default_answer if (defined($default_answer) and $answer eq '');
    while ($answer ne 'y' and $answer ne 'n')
    print "Please enter 'y' or 'n': ";
    $answer = lc(<STDIN>);
    chomp $answer;
    return ($answer eq 'y') ? 1 : 0;
    my $output = shift @ARGV;
    die "Please specify an output file.\n" if (not defined($output));
    my $new = &read_file('/etc/pacman.d/mirrorlist');
    my $orig = &read_file('/etc/pacman.d/mirrorlist.pacorig');
    my @new_servers = map {/^Server\s*=\s*(.+)\s*$/} grep {/^[#\s]*Server/} split "\n",$new;
    my @orig_servers = map {/^Server\s*=\s*(.+)\s*$/} grep {/^Server/} split "\n",$orig;
    my %servers = ();
    foreach my $server(@new_servers,@orig_servers)
    $servers{$server}++;
    my $mirrorlist = '';
    foreach my $server (@orig_servers)
    if ($servers{$server}>1)
    $mirrorlist .= "Server = $server\n";
    else
    print "The following server is no longer in the mirror list:\n\t$server\n";
    if (&confirm("Would you like to remove it?", "y"))
    next;
    else
    $mirrorlist .= "Server = $server\n";
    $mirrorlist .= "\n\n";
    $new =~ s/^Server/#Server/gm;
    $mirrorlist .= $new;
    &save_file($output,$mirrorlist);
    Last edited by Xyne (2008-12-23 21:07:20)

  • Update a table based on Min value of a column of a Another Table.Pls Help.

    Dear All,
    Wishes,
    Actually I need update statement some thing like below scenario...
    Data in table is like below:
    I wrote a query to fetch data like below ( actually scenario is each control number can have single or multiple PO under it ) (i used rank by to find parent to tree like show of data)
    Table: T20
    Control_no        P_no  Col3
    19950021     726473     00
    19950036      731016     00
    19950072     731990     00
                     731990 01
    19950353     734732     00
                     734732 01
    19950406     736189     00
                 736588     01
                 736588     02
                 736588     03                
    Table : T30
    Control_no      P_no              col3
    19950021     726473 
    19950036     731016
    19950072     731990     
                 731990     
    19950353     734732     
                  734732     
    19950406     736189     
                  736588     
                  736588     
                   736588     
      Now requirement is I need to update Table T30's col3 (which do have values in T20 but not this table) in such a way that , It should take MIN (COL3) from T20 and then update that value to related Col3)
    Better I can explain through below new data format in T30 after update:
    After update it should like:
    Table : T30
    Control_no       P_no    col3 (this is updated column)
    19950021     726473   00  -- as this is min value for Pno 726473 belongs to Control NO 199950021 in Table T20 above
    19950036     731016   00  -- as this is min value for Pno 726473 belongs to Control NO 199950021 in Table T20 above
    19950072     731990   00  -- see here..both Pno should updated as '00' as MIN value col3 in Table T20 related to this
                 731990      00     record is '00'  (out of 00,01 it should select 00 and update that value here)
    19950353     734732      00  -- same again both Pno should updated as '00' as MIN value col3 in TableT20 related to this
                 734732      00     record is '00'  (out of 00,01 it should select 00 and update that value here)
    19950406     736189      00  -- As there is single col3 value in T20, 00 should be updated here.
                 736588      01  --  Here it should update col3 as '01' since for this pno(736588)
                 736588      01  --  Here too it should update col3 as 01 per requirement ,minimum value of this pno in T20
                 736588      01  --     same here too.. Sorry if my post formatting is not good...
    Hope i am clear in my requirement..(update T30 col3 based on min value of col3 of related records)
    Please suggest some update sql for this...(ideas would be great)
    I am using oracle 10 g version soon will be migrated to 11g..
    Regards
    Prasanth
    Edited by: Onenessboy on Oct 20, 2010 12:13 PM
    Edited by: Onenessboy on Oct 20, 2010 12:15 PM

    Onenessboy wrote:
    I am really sorry, my post so nonsense in look..
    I used to use for actuall code..
    the out put i tryped, i used [pre] , [/pre] but still does not look good..
    hmm..thanks for your suggestion hoek..
    so any ideas about my requirement...I would suggest spending a bit more time trying hoek's suggestion regarding {noformat}{noformat} tags instead of repeatedly asking for more help.
    Because to understand your requirement, people are going to have to read it first.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Script to update EXIF data in iPhoto '08

    I shoot some photos with a digital Nikon D50, and some with a Leica M3 (35mm film). The pictures from the digital Nikon are encoded with plenty of detail in the EXIF tags, but the digitized images from the Leica and the 35mm film have only a few tags from the scanner.
    I wanted a script that would update the desired EXIF tags direct in iPhoto. I looked around on the Internet at other scripts, and wrote a simple script to update a few EXIF tags on selected images in iPhoto.
    I hope this script is of use to others.
    http://movingtomac.blogspot.com/2008/07/script-to-update-exif-data-in-iphoto-08. html

    since we don't have your tables or data, we can not run, test, or improve posted code.
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • "Itunes has stopped updating your podcast" message -- is there away around?

    When new podcasts are downloaded into Itunes, I transfer them straight to my ipod. I don't play them in Itunes.
    As a result, I have to tell Itunes that I DO want to continue downloading new files - for every podcast to which I subscribe, on a recurring basis.
    Seems to me that transferring the file shows signs of interest - same as playing.
    Is there a way to set Itunes to treat a transfer to the ipod the same as playing it?

    You're right, there is no way to turn off this asinine, infuriating feature. It's this kind of thing that drove me away from Windows and made me so happy when I got a Mac. I felt like I didn't have to fight the Windows Big Brother anticipating my needs and only allowing me to do things in a way that Windows wanted me to.
    Anyways, there is a partial solution, although its pretty sad compared to how easy it would be if Apple included a little checkbox in the options menu that said "Do you want iTunes to stop downloading your podcasts if you listen to them in any other way than on iTunes, even if you listen to them on your (Apple) iPod?". Go to http://www.dougscripts.com and check out the NeedleDrop script. It will let you automatically play 1 second or so of each podcast in your directory. You can then tell iTunes to update your podcasts and it will retrieve all of them, as it should anyways. One downside is that you'll have to run the NeedleDrop script every so often to update the playcount of your podcasts. Another downside, if you're a Windows user, is that the AppleScript will only work on Mac.
    As a tangent (read "rant"), iTunes is becoming really annoying lately. For starters, the interface has been looking more and more repulsively Windows-esque for the last few versions. Just recently, when I updated to the latest version of iTunes, it took me a week or so to delete the previous version because there was an application called "iTunes Helper" that wouldn't close. It didn't appear in the list of processes on my computer. Finally I found that it was a startup item in my list of startup programs. After disabling it, I was finally able to delete the old version of iTunes. Now iTunes doesn't update my podcasts if I don't listen to them in a way that iTunes deems fit. What is going on? Ugly interface, hidden processes, uncontrollable "features". Is Apple outsourcing their development to Microsoft or something?

  • Need script to place line break based on character style

    I'm a designer and know very little about scripting or XML, but here goes. I have some XML files I'm formatting for print, and they don't have paragraph returns where they need to be. The returns always need to be before a specific XML tag (that I can change to a specific character style to make it easier to find...). But I don't see a way to do this using the usual InDesign Find/Replace tools, so I assume scripting is going to be the answer. Anyone know how to accomplish this?
    Here's an example of the content I'm working with. The breaks need to happen BEFORE each <City> element. I'm using InDesign CS6 on a Mac.
    <?xml version="1.0" encoding="UTF-8"?>
    <Regions><Region>
    BIG BEND COUNTRY<City>
    <City_Name>ALPINE                       
    </City_Name><Event_Name>
    Big Bend Ranch Rodeo                                                                                </Event_Name>
    <Date>August 8-9                                                                                                                                                                                                                                                         
    </Date><Venue_Name>
    Sul Ross State University S.A.L.E. Arena</Venue_Name>
    <Website1>www.bigbendranchrodeo.com                                            
    </Website1><Phone1>
    4323642696</Phone1>
    <Phone2></Phone2>
    </City><City>
    <City_Name>ALPINE                       
    </City_Name><Event_Name>
    Big Bend Balloon Bash                                                                               </Event_Name>
    <Date>August 30-September 1                                                                                                                                                                                                                                                     
    </Date><Venue_Name>
    Alpine-Casparis Municipal Airport</Venue_Name>
    <Website1>bigbendballoonbash.com                                        
    </Website1><Phone1>
    4328377486</Phone1>
    <Phone2></Phone2>
    </City><City>
    <City_Name>EL PASO                      
    </City_Name><Event_Name>
    Alfresco! Fridays                                                                                   </Event_Name>
    <Date>August 1, 8, 15, 22, 29                                                                                                                                                           
    </Date><Venue_Name>
    Convention Center Plaza</Venue_Name>
    <Website1>www.alfrescofridays.com                                              
    </Website1><Phone1>
    915/534-0600</Phone1>
    <Phone2/></City>
    Thanks in advance!

    karol wrote:
    You can use [ code ] tags when pasting code https://bbs.archlinux.org/help.php#bbcode
    For it to really auto-update the mirrorlist it has to be put in a cronjob :-)
    If I run it twice, will the original mirrorlist (moved to mirrorlist.bak after the first run) be irrevocably lost?
    Just nitpicking: you don't have to use 'g' for global changes in the sed substitutions as there is only one occurrence per line.
    Thanks Karol - I made the adjustments above to address both comments. The 'g' for sed I think is OK to leave in :-)
    Last edited by Archieman (2011-05-31 04:00:55)

  • Lil' script to update adblockfilter, adblocking via /etc/hosts file

    hi, i've recently changed to adblocking via the hosts file (which works great btw), but i was missing  filtersetupdating like in firefox, so i've created with my limited scripting skills this one...
    # lil' script to update /etc/hosts adblock-filter
    #hosts adblock filter taken from this site...
    wget --directory-prefix=/tmp http://www.mvps.org/winhelp2002/hosts.txt
    #Backup /etc/hosts to /tmp
    cp /etc/hosts /tmp
    #standard static hosts file
    echo '# /etc/hosts: static lookup table for host names' > /etc/hosts
    echo '#' >> /etc/hosts
    echo '#<ip-address> <hostname.domain.org> <hostname>' >> /etc/hosts
    echo '127.0.0.1 localhost.localdomain localhost' >> /etc/hosts
    #add custom statc host configuration here
    echo ' ' >> /etc/hosts
    echo '###Ad-Blocking###' >> /etc/hosts
    cat /tmp/hosts.txt >> /etc/hosts
    echo '# End of file' >> /etc/hosts
    rm /tmp/hosts.txt
    enjoy!

    hosts_udate
    #!/bin/bash
    # 2012 Ontobelli for this script
    # make hosts temporal directory
    HOSTSDIR=~/.hostsupdate
    mkdir -p "${HOSTSDIR}"
    # make temporary directory
    TMPDIR=/tmp/hostsupdate
    mkdir -p "${TMPDIR}"
    # set output file
    OUTPUTFILE="${TMPDIR}/hosts"
    # set temporal file
    TMPFILE="${TMPDIR}/tmpfile"
    if [ ! -f "${HOSTSDIR}/hosts.local" ]; then
    echo "You need to create "${HOSTSDIR}"/hosts.local containing the hosts you wish to keep!"
    exit 0
    fi
    # download the mvps.org hosts file.
    wget -c -O "${HOSTSDIR}/hosts.mvps" "http://winhelp2002.mvps.org/hosts.txt"
    # download hpHOSTS
    wget -c -O "${HOSTSDIR}/hosts.hphosts" "http://support.it-mate.co.uk/downloads/HOSTS.txt"
    # download hpHOSTS Partial
    wget -c -O "${HOSTSDIR}/hosts.partial" "http://hosts-file.net/hphosts-partial.asp"
    # download hpHOSTS ad/tracking servers
    wget -c -O "${HOSTSDIR}/hosts.adservers" "http://hosts-file.net/ad_servers.asp"
    # download the pgl.yoyo.org hosts Peter Lowe - AdServers
    wget -c -O "${HOSTSDIR}/hosts.yoyo" "http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext"
    # download SysCtl Cameleon hosts
    wget -c -O "${HOSTSDIR}/hosts.sysctl" "http://sysctl.org/cameleon/hosts"
    # cat entries in a single file
    cat "${HOSTSDIR}/hosts.mvps" > "${TMPFILE}0"
    cat "${HOSTSDIR}/hosts.hphosts" >> "${TMPFILE}0"
    cat "${HOSTSDIR}/hosts.partial" >> "${TMPFILE}0"
    cat "${HOSTSDIR}/hosts.adservers" >> "${TMPFILE}0"
    cat "${HOSTSDIR}/hosts.yoyo" >> "${TMPFILE}0"
    cat "${HOSTSDIR}/hosts.sysctl" >> "${TMPFILE}0"
    # tabs to space
    sed -e 's/ / /g' "${TMPFILE}0" > "${TMPFILE}1"
    # find relevant lines without comments
    grep ^127.0.0.1 "${TMPFILE}1" > "${TMPFILE}2"
    # remove duplicate spaces
    cat "${TMPFILE}2" | tr -s [:space:] > "${TMPFILE}3"
    # remove carriage returns
    cat "${TMPFILE}3" | tr -d "\r" > "${TMPFILE}4"
    # 0.0.0.0 is nicer than constantly knocking on localhosts' door.
    sed -e 's/127.0.0.1 /0.0.0.0 /g' "${TMPFILE}4" > "${TMPFILE}5"
    # remove inline comments
    cut -d ' ' -f -2 "${TMPFILE}5" > "${TMPFILE}6"
    # sort blocklist entries and remove duplicates
    sort "${TMPFILE}6" | uniq > "${TMPFILE}7"
    # remove unneeded blocked sites
    grep -Ev ' dl.dropbox.com| host_you_want_to_whitelist' "${TMPFILE}7" > "${TMPFILE}9"
    # write the user's hosts.local to head, then the blacklists
    cat "${HOSTSDIR}"/hosts.local > "${OUTPUTFILE}"
    cat "${TMPFILE}9" >> "${OUTPUTFILE}"
    echo -e "# end of file" >> "${OUTPUTFILE}"
    # move to /etc/hosts
    mv "${OUTPUTFILE}" /etc/hosts
    # delete temporary directory
    rm -r -f "${TMPDIR}"
    hosts.local
    # /etc/hosts: static lookup table for host names
    #<ip> <hostname.domain.org> <hostname>
    127.0.0.1 localhost.localdomain localhost YOURHOSTSNAMEHERE
    ::1 localhost.localdomain localhost YOURHOSTSNAMEHERE
    # YOUR PERSONAL list
    # blocked list
    Create an alias in your ~/.bashrc
    alias hu='sudo /root/.hostsupdate/hosts_update'
    Run
    # hu <enter>
    Script and cache must be located in /root/.hostsupdate or modify scrip accordingly
    Cheers.
    Last edited by ontobelli (2012-02-15 09:15:17)

  • Is it possible to get the updated table records based on date & time.

    Is it possible to get the updated table records based on date & time in oracle.
    Thanks in advance.

    no, actually i am asking update records using 'UPDATE
    or DELETE' statement, but not insert statement.
    Is it possible?
    I think we can do using trigger on table, but problem
    is if i am having 20 tables means i have to write 20
    trigger. i don't want like this.Of course it's still possible, typically you'll find applications with a column LAST_UPDATE, probably a LAST_UPDATED_BY and so on column. You don't say what your business need is, if you just want a one of query of updates to particular records and have a recent version of Oracle, then flashback query may well help, if you want to record update timestamps you either have to modify the table, or write some code to store your updates in an audit table somewhere.
    Niall Litchfield
    http://www.orawin.info/

  • Update your Productdata

    Hi all!
    Everytimes when I try to download something SAP ERP or for the Solution Manager I got the Message Update your productdata. I know the notes that you have to upload the productdata and I've done this.
    Now I am not sure what is wrong. Has someone an idear what the problem is?
    Thanks a lot!
    Best regards
    Thomas

    Hi Thomas,
    Basically based on the error "Update your product data", literally means that the product data is out dated and out of sync. What you need to do specifically is to implement some corrections for SAINT/SPAM to skip this check.
    I think perhaps this note maybe of interest to you note 1326123
    Cheers,
    SH

  • Simple BASH script to update subversion files

    This is just a simple BASH script that will update all .svn files in a specified directory.  If an update fails, it will attempt to update all the subdirectories in the failed one, so as much will be updated as possible.  Theoretically, you should be able to supply this script with only your root directory ( / ), and all the .svn files on your computer will be updated.
    #! /bin/bash
    # Contributor: Dylon Edwards <[email protected]>
    # ================================
    # svnup: Updates subversion files.
    # ================================
    #  If the user supplies no arguments
    #+ then, update the current directory
    #+ else, update each of those specified
    [[ $# == 0 ]] \
        && dirs=($PWD) \
        || dirs=($@)
    # Update the target directories
    for target in ${dirs[@]}; do
        # If the target file contains a .svn file
        if [[ -d $target/.svn ]]; then
            # Update the target
            svn up $target || {
                # If the update fails, update each of its subdirectories
                for subdir in $( ls $target ); do
                    [[ -d $target/$subdir ]] &&
                        ( svnup $target/$subdir )
                done
        # If the target file doesn't contain a .svn file
        else
            # Update each of its subdirectories
            for subdir in $( ls $target ); do
                [[ -d $target/$subdir ]] &&
                    ( svnup $target/$subdir )
            done;
        fi
    done

    Cerebral wrote:
    To filter out blank lines, you could just modify the awk command:
    ${exec awk '!/^$/ { print "-", $_ }' stuffigottado.txt}
    very nice; awk and grep: two commands that never cease to amaze me.

  • Powershell Script to Update Central PolicyDefintions Store against the local machine

    Hi all,
    i've created a powershell script to update my central policydefinitions store against a local machine for example the newest domaincontroller or member server. It can be started with the parameters -source (for the source directory e.g. C:\Windows\PolicyDefinitions)
    and -destination (for the target directory e.g. C:\Windows\SYSVOL_DFSR\sysvol\domain.local\Policies\PolicyDefinitions).
    It checks the source directory for language folders and admx files. Compares the Fileage with the files in the target directory and allows you to replace them. Maybe this script is helpful for one of you and maybe someone can check it and give me some feedback
    to make this script better.
    Please be very careful with this and try it on your own risk. You should try it in a testenvironment first. Or e.g. against an empty target directory. In the first version the script asks for confirmation for every single change against the target directory.
    You can find it here: http://pastebin.com/dwJytWck
    Regards

    Hi,
    You may also want to add this script to the script repository:
    https://gallery.technet.microsoft.com/scriptcenter
    That'll make it easier for more people to find.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Need help on Executing this Script to update LyncDatabase remotely

    Hi All,
             I have some problem with executing the below script (to update the LyncDB post CU4 patched on Lync Servers) remotely, but it works fine Locally(from any Lync FE machine),
    Script: Install-CsDatabase -Update -ConfiguredDatabases -SqlServerFqdn "LyncDB.Julie.local" -UseDefaultSqlPaths
    When executing locally from any Lync FE Machine(LyncFE.julie.local), its working fine "Piece of Output for your reference"
    Output:
    PS C:\Users\julie> 
    Install-CsDatabase -Update -ConfiguredDatabases -SqlServerFqdn "LyncDB.Julie.local" -UseDefaultSqlPaths
    ****Creating DbSetupInstance for 'Microsoft.Rtc.Common.Data.BlobStore'****
    Trying to connect to Sql Server LyncDB.Julie.local. using windows authentication...
    Sql version: Major: 11, Minor: 0, Build 3128.
    Sql version is acceptable.
    Checking state for database rtcxds. it use to go like this for few pages to update all 06 database
    Remote Script:
    $sessionoption=new-pssessionoption -SkipRevocationCheck
    $password=ConvertTo-SecureString -String "*******" -AsPlainText -Force
    $credential=New-Object System.Management.Automation.PSCredential("******", $password)
    $session=New-pssession -ComputerName "LyncFE.julie.local" -port 5985 -Credential $credential -Authentication
    Negotiate -SessionOption $sessionoption
    Try{
    $cmd=invoke-command -session $session -scriptblock{
    Install-CsDatabase -Update -ConfiguredDatabases -SqlServerFqdn "LyncDB.Julie.local" -UseDefaultSqlPaths
    Write-Host $cmd
    Remove-PSSession -Session $Session;
    Catch
      $RetVal = "Error23: " + $error[0].Exception.toString()
    $cmd
    Error:
    Output:
    WARNING: Install-CsDatabase failed.
    WARNING: Detailed results can be found at "C:\Users\Julie\AppData\Local\Temp\Install-CsDatabase-52517af7-39ea-482e-8ba6-166a15cf8
    4d2.html".
    Command setup failed: Active Directory error "-2147016672" occurred while searching for domain
    controllers in domain 
    "ad.*****.com": "An operations error occurred.
        + CategoryInfo          : InvalidOperation: (:) [Install-CsDatabase],
    ADTransientException
        + FullyQualifiedErrorId : BeginProcessingFailed,Microsoft.Rtc.Management.Deployment.InstallDatabaseCmdlet
        + PSComputerName        : LyncDB.Julie.local.com

    I tried both the Option, both still I'm getting the same error like the below,
    Error:
    Output:
    WARNING: Install-CsDatabase failed.
    WARNING: Detailed results can be found at
    "C:\Users\Julie\AppData\Local\Temp\Install-CsDatabase-52517af7-39ea-482e-8ba6-166a15cf8
    4d2.html".
    Command setup failed: Active Directory error
    "-2147016672" occurred while searching for domain controllers in domain 
    "ad.*****.com": "An operations error occurred.
        + CategoryInfo    
         : InvalidOperation: (:) [Install-CsDatabase], ADTransientException
        + FullyQualifiedErrorId : BeginProcessingFailed,Microsoft.Rtc.Management.Deployment.InstallDatabaseCmdlet
        + PSComputerName    
       : LyncDB.Julie.local.com

  • On 10.4.11 Mac Mail I get this: Mail cannot update your mailboxes because your home directory is full. You must free up space in your home folder before using Mail. Delete unnedded documents or move documents to another volume. I can't open mail.

    On 10.4.11 iMac Mac Mail I get this message: "Mail cannot update your mailboxes because your home directory is full. You must free up space in your home folder before using Mail. Delete unneeded documents or move documents to another volume." I can't open mail to do this. I have reinstalled software but no effect. How do I get into Mail to delete?

    Found this on the "more like this" Worked like a charm!
    With the Mail.app quit and using the Finder, go to Home > Library > Mail. Copy the Mail folder and place the copy on the Desktop for backup purposes.
    Go to Home > Library > Mail > Envelope Index. Move the Envelope Index file to the Desktop.
    Launch Mail and you will be prompted to import mailboxes. Select OK and allow the import process to complete.
    After confirming all mailboxes were successfully imported and available, you can delete the copy of the Mail folder and old Envelope Index file from the Desktop and this should resolve the problem.

  • "Mail cannot update your mailboxes because your home directory is full"

    I have a 250 GB hard disk, 4.34 GB of which is in my "Home" folder. (Total HD usage is about 27 GB.) This happened suddenly after Mail had been working fine for eons. I deleted a bunch of files (107 MB) in a "Drafts" folder (none show up in the Mail app's "Drafts" icon), but it made no difference. I re-installed the Mac OS X 10.4.11 combo update... no difference. Mail version is 2.1.3.
    Any help here? I cannot use Mail at all.
    Message was edited by: Bill Strohm

    Hey there,
    Have you had a chance to look at this Apple support document relating directly to this issue. Hope it helps.
    [Mac OS X 10.4: "Mail cannot update your mailboxes because your home directory is full" alert|http://support.apple.com/kb/TA24486?viewlocale=en_US]
    B-rock

Maybe you are looking for