Skip to content

Instantly share code, notes, and snippets.

@dcorking
Created May 10, 2013 11:31
Show Gist options
  • Save dcorking/5553860 to your computer and use it in GitHub Desktop.
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'.
#!/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
#!/bin/sh
/home/david1/bin/repeated-fedup.rb
@dcorking
Copy link
Author

MIT License. No warranty.

@dcorking
Copy link
Author

dcorking commented Jun 3, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment