A simple script that removes older packages from cache dir

Hello all,
I wrote a small bash script that removes packages (from cachedir /var/cache/pacman/pkg), older than the ones available in repositories (eg. if the current version of pacman is 2.6.3, it will remove pacman-2.6.2 from cachedir). It implements the functionality of debian's 'apt-get autoclean'.
Get it from http://www.kegep.tuc.gr/~manolis/archlinux/cleanold.sh.

thanks a lot for sharing this 

Similar Messages

  • [SOLVED] Script to clear all but the current packages from cache?

    Has anyone written, found such a script, or like to write one?
    It just has to delete all older duplicate packages in /var/cache/pacman/pkg/ .  After which keeping a superseded copy of packages just comes down to when you use the script.
    It would keep the /var/cache/pacman/pkg/ directory slimmer, (though it would still have more than is required in it I know) & ensure a quick recovery through downgrading to a known good package when required.
    It would be so easy to run the script before an -Syu --aur  so that if you have any problems you still have the superseded version of whatever, that you can downgrade to until the problem is solved
    Last edited by handy (2008-12-18 07:37:10)

    man pacman wrote:
    SYNC OPTIONS
           -c, --clean
               Remove packages that are no longer installed from the cache as well
               as currently unused sync databases to free up disk space. When
               pacman downloads packages, it saves them in a cache directory. In
               addition, databases are saved for every sync DB you download from,
               and are not deleted even if they are removed from the configuration
               file pacman.conf(5). Use one --clean switch to only remove packages
               that are no longer installed; use two to remove all packages from
               the cache. In both cases, you will have a yes or no option to
               remove packages and/or unused downloaded databases.
               If you use a network shared cache, see the CleanMethod option in
               pacman.conf(5).
    Does "pacman -Sc" not do what you are suggesting?

  • How to remove a package from package structure?

    Hello profs,
    i have a problem. I add a package 'A' to another package 'B' in the package builder.
    Now i don't know how to remove package 'A' from the list of package 'B'.
    I have not found in the docu of package builder how to remove a package from the included list.
    Has somebody an idea how to do it?
    Thanks a lot.

    I found out that the relation between the packages saved in table TDEVC.
    Field PARENTCL contains the surrounding package 'B' of the package 'A' field DEVCLASS.
    At the moment the only way to remove the package is to modify the table.
    But i look for another possibility for this issue.
    Best regards
    Waldemar

  • Simple script that will export the coordinates (layer bounds - top left x,y)

    Hi,
    I'm looking for a simple script that will export the coordinates (layer bounds - top left x,y) of the layers to an seperate xml/txt file.

    Your screen capture looks like it's from Photoshop.
    In InDesign sub layers are page items, the containing layer has no dimension. So you could get all the page item's x, y, width, height. But you might have to consider groups and then the layering could be very complex. The stacking order could also get complex. Page items have an index, but it's relative to its parent container.

  • Installing older package from aur

    how do I revert to an older package from the aur? I installed the new build of utorrent and it won't run so I was wondering how to revert back to the old build? thanks

    Allan wrote:If I was the author, I would have just responded "yes"! 
    Well, my first thought was "of course it fscking is", but in the spirit of the forum I gave a more diplomatic answer.
    Last edited by Xyne (2010-12-26 07:13:50)

  • About remove the statement from cache

    Hi Guys,
    I am tuning a statement and it is slower in biginning and then faster after been cached. So I couldn't get reproduce the slower case. Is there any way to remove the statement from cache so that I can continue to test. Thanks.

    As Billy has already answered, the first time you run the query, it's probably doing far more physical I/O than logical and this can make it run slower than on subsequent executions. To remove the data from the buffer cache, this has also been answered already. In 10g you can flush the buffer cache and in earlier versions you could "offline-online" a tablespace for tables in your query.
    If you are trying to invalidate an execution plan in the shared pool (i.e. not the data blocks), you can do one of the following:
    a) flush the shared pool using ALTER SYSTEM
    b) invalid your plan with dbms_stats.gather_table_stats for one of the tables in the query with NO_INVALIDATE=>FALSE
    c) invalidate your plan with dbms_stats.export/import_table_stats for one of the tables in the query (i.e. don't change the stats, just invalidate the plans with NO_INVALIDATE=>FALSE)
    d) invalidate your plan with a "no-change" ALTER TABLE for one of the tables in your query. e.g. ALTER TABLE x LOGGING (if it is already logging).
    Note that options b) to d) will affect potentially more cursors than just the one you are testing (i.e. any that reference the table you use).
    Regards

  • In My iphone 5s,i have disabled automatic download from whatsapp app.So whichever images,video i feel is good i download them and then save them to my camera roll section.So i want to know how can i remove the images from cache of my phone.

    In My iphone 5s,i have disabled automatic download from whatsapp app.So whichever images,video i feel is good i download them and then save them to my camera roll section.So i want to know how can i remove the images from cache of my phone which are downloaded and not saved,but they remain in cache.
    Even in some apps i have data which i want to remove,but cant find a way to remove them and they are in my cache eating up my memory.

    Try assigning Queen as the Album Artist on the compilations in iTunes on your computer.

  • Looking for Help with Active Directory Script to Remove a User from msExchDelegateListLink

    I'm struggling to put together an Active Directory Powershell script that will remove a specific user from the msExchDelegateListLink.
    It looks like Set-AdUser would do the trick. I would want to remove a user in the format of
    {CN=Wood\, Sandy,OU=Networking,OU=IT,DC=my,DC=domain,DC=com}
    Has anyone succeeded in doing this before?
    Orange County District Attorney

    I use this:
    $user = '<user name>'
    $userDN = Get-ADUser $user | select -ExpandProperty DistinguishedName
    $delegates = Get-ADUser $user -Properties msExchDelegateListBL |
    select -ExpandProperty msExchDelegateListBL
    foreach ($delegate in $delegates)
    Set-ADUser $delegate -Remove @{msExchDelegateListLink = "$UserDN"}
    Never quite got around to putting it into a function.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Vb scripts to remove the user from the member of perticular group (say from domain admin) from windows servers 2003 and 2008

    Hi,
    I need VB script which to checks the perticular user in AD and if it exists;that user needs to be removed from the member of perticular group
    Ex:- Lets say
    I have a user 783562 , I need to search this user in AD to verify user exists or not. If not then I no need to remove the mebership from perticular group
    Second scenario:-
    If user exists then I need to remove the user membership from the perticular group.I want to do it in automation
    Manual Path:-
    1.Type dsa.msc in run command of IT session(we using it to connect remote desktop).
    2. Select the domain & right click (EX:-corp.ds.xxyyzz.com) and select "Find" to find the user form the domain.
    3. Type the user name in the Name field and click on "Find Now" button user name will be displayed in search result.
    4. Double click on this user ID and select "Member Of" tab.
    5. Select any member of group from the Name section then click on "Remove" button.
    6. Finally click on "Apply" and "OK" button.
    Kindly help me out to do this by using vb script.
    Thanks
    Raja

    Usage: CScript NameOfVBS.vbs //NOLOGO /User:Jane.Doe /GroupDN:CN=Group1,DC=Contoso,DC=com
    Option Explicit
    On Error Resume Next
    Dim str_User
    Dim str_GroupDN
    Dim obj_Connection
    Dim obj_Command
    Dim obj_RootDSE
    Dim str_DNSDomain
    Dim str_Base
    Dim str_Filter
    Dim str_Attributes
    Dim str_Query
    Dim obj_RecordSet
    Dim obj_Group
    Dim str_ADsPath
    Dim obj_User
    str_User = WScript.Arguments.Named("User")
    str_GroupDN = WScript.Arguments.Named("GroupDN")
    If Len(Trim(str_User)) > 0 And Len(Trim(str_GroupDN)) > 0 Then
    Set obj_Connection = CreateObject("ADODB.Connection")
    Set obj_Command = CreateObject("ADODB.Command")
    obj_Connection.Provider = "ADsDSOOBject"
    obj_Connection.Open "Active Directory Provider"
    Set obj_Command.ActiveConnection = obj_Connection
    Set obj_RootDSE = GetObject("LDAP://RootDSE")
    str_DNSDomain = obj_RootDSE.Get("defaultNamingContext")
    str_Base = "<LDAP://" & str_DNSDomain & ">"
    str_Filter = "(&(objectCategory=person)(sAMAccountName=" & str_User & "))"
    str_Attributes = "cn,ADsPath"
    str_Query = str_Base & ";" & str_Filter & ";" & str_Attributes & ";subtree"
    obj_Command.CommandText = str_Query
    obj_Command.Properties("Page Size") = 1000
    obj_Command.Properties("Timeout") = 1
    obj_Command.Properties("Cache Results") = False
    Set obj_RecordSet = obj_Command.Execute
    obj_RecordSet.MoveFirst
    If obj_RecordSet.RecordCount = 0 Then
    WScript.Echo str_User & " was not found"
    Else
    Set obj_Group = GetObject("LDAP://" & str_GroupDN)
    str_ADsPath = obj_RecordSet.Fields("ADsPath")
    Set obj_User = GetObject(str_ADsPath)
    obj_Group.Remove(obj_User.AdsPath)
    If Err.Number = 0 Then
    WScript.Echo str_User & " was removed from group " & str_GroupDN
    ElseIf Err.Number = -2147016651 Then
    WScript.Echo str_User & " not a member of group " & str_GroupDN
    Else
    WScript.Echo str_User & " error removing from group " & str_GroupDN
    End If
    End If
    End If

  • Looking for a script that get images' urls from a website

    Hi,
    I have a website where users can insert theirs hotel informations.
    Most of them do not insert photos, I guess because the procedure is quite long and difficoult for the average user's skills.
    I'm looking for a script that take as input the url of the website and give as output the urls of the images of the site, so the user can decide which to upload on his tab.
    Someone can help me?

    La_Salamandra wrote:
    I have a website where users can insert theirs hotel informations.
    Most of them do not insert photos, I guess because the procedure is quite long and difficoult for the average user's skills.
    I'm looking for a script that take as input the url of the website and give as output the urls of the images of the site, so the user can decide which to upload on his tab.
    Someone can help me?
    You have to improve your design. Even if you can find the Coldfusion code, your design will still fall short in 2 ways.
    First, it is unreliable, because you're depending on some arbitrary site to be available and up to speed. Secondly, it is aesthetically wrong to be collecting pictures, especially large numbers of them, dynamically from someone else's site.  Think of their copyright and bandwidth.
    Fortunately, there are simple solutions. First, identify, by eye, the web pages containing the pictures you're interested in. Ask for permission from the owner.
    You could indeed use Coldfusion's cfhttp or any other script to download the JPGs, PNGs, and so on. But then, why waste your time re-inventing the wheel? It is infinitely better to use a web crawler !
    With most crawlers, you only have to supply the URL of the site, and the file extensions it has to grab (in your case, jpg, png, bmp, and so on).
    One click on the button, and you have them reeling in. Automatically. Some crawlers are considerate enough to enable you to adjust the download bandwidth. (We can learn from a million years evolution wisdom. The vampire bat is known to inject a painkiller before sucking!).
    Now that you've downloaded the images to your site, the links you display to your users are all yours. You may choose to resize some of the images, display them as you wish, and the issues of reliability and bandwidth are now up to you.

  • Looking for a Mail utility/script to remove older newsletters

    I subscribe to several newsletters from various companies (airlines, hotels, etc) and I'm looking for a utility/script that looks at incoming mail and zaps/displays older mailings since the new message supersedes the older ones. For instance, weekly discount offers come in and I want the previous ones from the same company to be automatically deleted. A confirmation window displaying the candidate messages to be deleted would be a nice feature.
    Does anybody know of such a utility?
    TIA

    well, to catch an email you have to add the email address from the sender or distinctive text, so for simplification purposes you may have to create a rule for each newletter, rather than one rule with lots of text in that field. plus if you create one rule for each, then it is easier to troubleshoot if one newsletter does not get deleted in the way you have specified it.
    glad i could help

  • Is it possible to automate/script the removal of workflows from workflow archive?

    We don't allow our CQ authors to activate content directly.  They must activate their content by executing a custom approval workflow we'd developed as part of our first CQ project.  As you can imagine this workflow is run very often.  So much so that when it came time to upgrade from CQ v5.4 to CQ v5.5 there were too many for me to purge the workflow archive and leaving all those workflows in place caused the upgrade process to run for a very long time.  At the time I was provided with a package for the CQ v5.4 environment that once installed provided a component (/apps/tools/components/purgewf/run.html) that I could then then leverage to kick off a process that given enough time would purge all of the workflows from the workflow archive.
    Now that we are on CQ v5.5 I'd like to be proactive and develop a script that I can schedule to execute on a regular basis that would basically do the same thing as that component from CQ v5.4.  Does anybody know if there's an easy way to do this with CQ v5.5?  Could I simply install the same component that I was given for CQ v5.4 and then leverage curl to kick the process off as I've done that sort of thing before to kick off JMX operations such as runDataStoreGGarbageCollection.  This wouldn't be a JMX operation but I'm thinking it migh actually be easier to use curl to kick of something like purgewf/run.html though I'm not really sure what I'm basing that on other than instinct.

    This has proved very helpful thank you.
    Although I've one point of clarification I could still use some help with.  The document provided by Sham, HC mentions within that it's possible to clean up workflows that have had a status of RUNNING for more than 1 day but it seems to be saying its neccessary to create a list of those workflow models you want this feature of the purge mechanism to act on.  I've looked the Felix configuration over and I can't see that any of the properties there would accept a list of workflow model names and I've tried all of the various modes that are available for the process and none of them do this automatically by assuming any sort of default value for this list.  Is this capablity really there?  Not that I see the ability to purge RUNNING workflows as critical functionality for the purge process as the number of problem workflows with this status tends to be managable but if yet if there's a way to make it do it in addition to clean out the archive it would be nice.

  • System offline - coincided with removing TV package from my account

    On 7/17 I removed the TV package from my account, as you may have guessed from the post title. It took a few days, but I noticed that the home monitoring and control was no longer sending notifications. When I tried to log into the app, it told me "you do not have home monitoring and control" - same with the web portal designed to manage this service.
    My first call to tech support went something like this:
    "Are you sure that no one accidentally turned this off on my 7/17 call?"
    "There is absolutely no way that could have happened."
    Voice mail from Verizon, later:
    "Someone accidentally turned this off. It should work now."
    My next call, after the system still did not work, resulted in the agent asking me to do a reset of the gateway device, and to wait 30 minutes - call back if it's not working. Guess what, that didn't work  - nice that the agent got off the call so quickly.
    After several additional calls, it is not working. I now have an open and "escalated" support ticket, essentially useless equipment, and no faith whether the service is actually enabled in all the right places on Verizon's side.
    Solved!
    Go to Solution.

    Well, good luck, you will need it. When something like that happens they normally have to rebuild your whole account. And since they don't sell HM&C anymore, they may not beable to setup a new account with that option. :-(
    My suggestion is to ride the hard. Call several times a day if you have to and get a superviser's name, deal only with that person and demand a daily update. Here's the direct number in case you don't already have it: 866-785-8153
    If they can't get you working again and you want to sell your equipment, let me know.
    Oh, and first rule of tech-support, don't let the tech off the phone until the problem is resolved or they have to send you to the next level support.

  • Powershell script for removing some users from a particular Site Collection

    Hi,
    I am looking for a PowerShell script to delete a few users from a particular Site Collection. I am unable to delete them from/_catalogs/Users/simple.aspx page therefore need some other medium to
    delete users from the site collection.
    My ultimate aim is to have no user profile with "tp_deleted" field's value as 0 in the USERINFO table. Currently there are about 40 odd users with this field's value as 0 and this is affecting my crawling of this content database.

    Thanks for the reply Alex & eHaze,
    I have a content source of root site which crawls all the site collections under it. Out of the 9 site collections, only 8 are getting crawled and 1 doesn't get crawled at all. The error in the crawl logs is 
    The SharePoint item being crawled returned an error when requesting data from the web service. ( Error from SharePoint site: Value does not fall within the expected range. )
    I tried a lot of things, searched over the net and finally found
    this which helped me solve the same issue in my development environment. I deleted these users from userInfo table and ran a full crawl. And the issue was fixed.
    Now since I cannot delete the users from userInfo table directly from PROD environment, I used .../_catalogs/Users/simple.aspx list
    to delete users from this site collection. While some of the users I could delete, quite a few I could not. Clicking on the profile redirected me to the home page rather than the info page of the profile. 
    This
    is why I have to delete these users from the site collection.
    Alex - the link you shared, I guess it is for a web application level.
    eHaze - the script you shared throws this error:
    Get-SPSite : Cannot find an SPSite object with Id or Url: http://dev-apps/divisions/BT. At C:\PowerShell Scripts\DeleteUserFromSiteCollection1.ps1:4 char:19
    + $site = get-spsite <<<< $siteURL
    + CategoryInfo : InvalidData: (Microsoft.Share...SPCmdletGetSite:
    SPCmdletGetSite) [Get-SPSite], SPCmdletPipeBindException
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetSite
    You cannot call a method on a null-valued expression.
    At C:\PowerShell Scripts\DeleteUserFromSiteCollection1.ps1:9 char:27
    + $site.SiteUsers.Remove <<<< ($LoginName)
    + CategoryInfo : InvalidOperation: (Remove:String) [], RuntimeExc
    eption
    + FullyQualifiedErrorId : InvokeMethodOnNull
    hope this info helps.

  • How would I create a simple script that does these specific things?

    I am trying to create a script that does these few simple task but I can't seem to compile all the cmdlets together into one. I can pick one task out and have a command for it but I want one script to do it all. Here are the tasks I need it to do.
    store the current location (as in C:\scripts)
    test to see if a folder C:\output exists, if it does not, create it
    prompt the visitor for a folder name (no C:\)
    obtain a directory listing of that folder showing all .ps1 files only
    place the results of this listing in a file named PS1_files_[folder name].txt in the c:\output folder
    repeat this task as part of a loop until an empty string is entered
    restore the present location (for example C:\scripts)

    This is a very good script for a someone new to computers to use as a learning exercise.  You will learn how the computer works an learn how to use scripts to manage the computer.
    This is the excat kind of scritp a teach hands you to do on the first day of class.  THe challenge will help you learn.
    Start here to learn how to write a script:http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
    Good luck. Post back with specific questions.  Do not forget to include your script and the complete error message.
    You need to learn basic computer logic and decision making.  The learning materials will step you through that.
    ¯\_(ツ)_/¯

Maybe you are looking for