Results 1 to 7 of 7

Thread: Executing a script after apt-get upgrade

  1. #1
    Join Date
    Feb 2007
    Beans
    24

    [solved] Executing a script after apt-get upgrade

    Hi,

    I would like to execute a script automatically after each apt-get upgrade. Is there an easy way to do that?
    Last edited by Axio; March 9th, 2012 at 01:48 PM.

  2. #2
    Join Date
    Jan 2010
    Location
    Kolkata India
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Executing a script after apt-get upgrade

    Try doing an apt-get upgrade through a script and call your script other script from current one .
    “Progress is made by lazy men looking for easier ways to do things”
    — Robert A. Heinlein

  3. #3
    Join Date
    Feb 2012
    Beans
    Hidden!

    Re: Executing a script after apt-get upgrade

    Code:
    #!/bin/bash
    
    # This runs update and upgrade
    sudo apt-get update; sudo apt-get upgrade
    
    # Change into the directory of your script
    cd ~/scripts
    
    # And run it
    ./my_script.sh
    
    # Or run some other command
    dpkg --get-selections | grep firefox
    Then, providing this script is called "after-update.sh", run

    Code:
    chmod +x after-update.sh
    ./after-update.sh
    Cheers

  4. #4
    Join Date
    Nov 2010
    Location
    India
    Beans
    4,828
    Distro
    Ubuntu Development Release

    Re: Executing a script after apt-get upgrade

    Code:
    sudo apt-get upgrade ; ./<your script >
    Raja

    రాజ శేఖర్ రెడ్డి

  5. #5
    Join Date
    Feb 2007
    Beans
    24

    Re: Executing a script after apt-get upgrade

    THanks it is what I needed! I should have thought about it before.

  6. #6
    Join Date
    Jan 2010
    Location
    Kolkata India
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Executing a script after apt-get upgrade

    IF you have got your solution , never forget to mark the thread as closed .
    Cheers .
    “Progress is made by lazy men looking for easier ways to do things”
    — Robert A. Heinlein

  7. #7
    Join Date
    Dec 2010
    Location
    Bangalore
    Beans
    118
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Executing a script after apt-get upgrade

    apt-get upgrade && sh "path of your script"
    Last edited by pavi_elex; March 9th, 2012 at 04:15 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •