简体   繁体   English

继续执行Python更新脚本,而无需等待用户输入

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

I have written a simple script to carry out all my system updates and clean up on my Fedora 19 machine in one go: 我编写了一个简单的脚本来执行所有系统更新并一次性在Fedora 19机器上进行清理:

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? 如何将其编码到脚本中,以自动删除旧内核,而无需等待用户确认?

也用'-y'运行package-cleanup。

package-cleanup -y --oldkernels

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在不停止脚本和等待用户表单输入的情况下,将变量从Flask Form更新为连续运行的python脚本? - How do I update variable from Flask Form to a continuously running python script, without the script stopping and waiting for the user form input? 如何以其他用户身份继续执行python脚本 - How to continue the execution of python script as a different user 如何在不等待Python的情况下接受用户输入 - How to accept user input without waiting in Python 如何在用户更改后继续执行python脚本 - How to continue he execution of python script after user change 有没有办法在不等待用户输入的情况下打印 python 数据表 - Is there a way to print python datatable without waiting for user input at the end 在后台运行 Python HTTPServer 并继续执行脚本 - Run Python HTTPServer in Background and Continue Script Execution python在运行脚本时等待输入 - python waiting for input while running script 在等待输入 python 时更新 turtle/gui - Update turtle/gui while waiting for input python python3 如果没有用户输入更新变量,我如何继续循环? - python3 How do I continue a loop if no user input to update variable? Python调用脚本而不等待它执行 - Python calling script without waiting for it to execute
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM