PDA

View Full Version : [ubuntu] Executing a script after apt-get upgrade



Axio
March 9th, 2012, 12:47 PM
Hi,

I would like to execute a script automatically after each apt-get upgrade. Is there an easy way to do that?

codemaniac
March 9th, 2012, 01:01 PM
Try doing an apt-get upgrade through a script and call your script other script from current one .

baumanno
March 9th, 2012, 01:45 PM
#!/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


chmod +x after-update.sh
./after-update.sh

Cheers

raja.genupula
March 9th, 2012, 01:46 PM
sudo apt-get upgrade ; ./<your script >

Axio
March 9th, 2012, 01:47 PM
THanks it is what I needed! I should have thought about it before.

codemaniac
March 9th, 2012, 01:52 PM
IF you have got your solution , never forget to mark the thread as closed .
Cheers .

pavi_elex
March 9th, 2012, 04:11 PM
apt-get upgrade && sh "path of your script"