Created
May 10, 2013 11:31
-
-
Save dcorking/5553860 to your computer and use it in GitHub Desktop.
I wrote this to run as a job to help with an upgrade from Fedora 17 to Fedora 18. It runs fedup repeatedly, for example if yum fails due to the python error, 'Cannot allocate memory'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ruby | |
####################### | |
# "repeated-fedup.rb" # | |
####################### | |
# runs fedup repeatedly, for example if yum fails due to the | |
# python error, 'Cannot allocate memory' | |
# continually updates a fedupdebugXX.log in the current directory | |
# run as follows to make use of off peak bandwidth, but remember | |
# to stop it before peak times | |
# sudo at -f /home/david1/bin/repeated-fedup.sh 23:05 | |
# TODO should this script be suid? | |
# TODO initialize counter with a command line argument | |
counter = 54 | |
while counter < 200 | |
helloCmd = "echo 'Hello from the shell, at count #{counter}'" | |
system helloCmd | |
# if you were an ordinary user, you would run the following as | |
# "sudo su -c 'fedup-cli --network 18 --debuglog fedupdebug#{counter}.log'" | |
fedupCmd = "fedup-cli --network 18 --debuglog fedupdebug#{counter}.log" | |
puts "I'll run this command: " + fedupCmd | |
system fedupCmd | |
counter += 1 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
/home/david1/bin/repeated-fedup.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This worked successfully on a machine with 1GB of RAM. After fedup finally completes successfully, repeated-fedup continues to run it: those subsequent runs produce harmless errors in your log, so you will need to scroll up through your log to find the success. Once fedup has downloaded all the packages, you can reboot to start the next step of the upgrade process.