Continue execution of a Python update script without waiting for user input

StackOverflow https://stackoverflow.com/questions/21670617

  •  09-10-2022
  •  | 
  •  

سؤال

I have written a simple script to carry out all my system updates and clean up on my Fedora 19 machine in one go:

import os

os.system('clear') # clear the terminal screen

os.system('yum -y update') # update the system without asking for confirmation

os.system('package-cleanup --oldkernels') 

os.system('package-cleanup --problems')

os.system('package-cleanup --dupes')

os.system('yum clean all')

exit()

The only issue is that in case there are old kernels to remove, the system will ask for user confirmation. How can I code this into the script, to automatically remove the old kernels without waiting for user confirmation?

هل كانت مفيدة؟

المحلول

Run package-cleanup with '-y' too.

package-cleanup -y --oldkernels
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top