lnlidawei

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

os:  fedora38 系统更新脚本 - update - (echo 'PASSWORD' | sudo -S <command>)

 

 

 

 

一、update脚本内容(echo "PASSWORD"  |  sudo -S  <command>)

 

   1、update

 1 [wit@fedora null]$ cat ~/user/tools/update 
 2 #!/usr/bin/env bash
 3 
 4 
 5 
 6 
 7 echo
 8 echo -- update --
 9  echo PASSWD | sudo -S date "+%F %T";
10  echo PASSWD | sudo -S dnf clean all -y;
11  echo PASSWD | sudo -S dnf makecache -y;
12  echo PASSWD | sudo -S dnf upgrade -y;
13  echo PASSWD | sudo -S dnf update -y;
14  echo PASSWD | sudo -S dnf upgrade -y;
15  echo PASSWD | sudo -S dnf autoremove -y;
16 echo -- update end --
17 echo
18 [wit@fedora null]$ 

 

 

  2、update

 1 [wit@fedora null]$ cat ~/user/tools/update 
 2 #!/usr/bin/env bash
 3 
 4 
 5 
 6 
 7 echo
 8 echo -- update --
 9  echo PASSWD | sudo -S date "+%F %T";
10  echo PASSWD | sudo -S dnf clean all -y;
11  echo PASSWD | sudo -S dnf makecache -y;
12  echo PASSWD | sudo -S dnf upgrade -y;
13  echo PASSWD | sudo -S dnf update -y;
14  echo PASSWD | sudo -S dnf upgrade -y;
15  echo PASSWD | sudo -S dnf autoremove -y;
16 echo -- update end --
17 echo
18 [wit@fedora null]$ 
19 [wit@fedora null]$ 
20 [wit@fedora null]$ update
21 
22 -- update --
23 2023-09-17 19:23:19
24 69 files removed
25 Copr repo for PyCharm owned by phracek                     16 kB/s |  45 kB     00:02    
26 Fedora 38 - x86_64                                        1.9 MB/s |  83 MB     00:42    
27 Fedora 38 openh264 (From Cisco) - x86_64                  1.0 kB/s | 2.5 kB     00:02    
28 Fedora Modular 38 - x86_64                                1.0 MB/s | 2.8 MB     00:02    
29 Fedora 38 - x86_64 - Updates                              5.1 MB/s |  32 MB     00:06    
30 Fedora Modular 38 - x86_64 - Updates                      805 kB/s | 2.1 MB     00:02    
31 google-chrome                                             6.3 kB/s | 3.6 kB     00:00    
32 The Netwide Assembler                                     1.3 kB/s | 4.5 kB     00:03    
33 RPM Fusion for Fedora 38 - Nonfree - NVIDIA Driver        1.8 kB/s |  14 kB     00:07    
34 RPM Fusion for Fedora 38 - Nonfree - Steam                429  B/s | 2.2 kB     00:05    
35 Last metadata expiration check: 0:00:01 ago on Sun 17 Sep 2023 07:26:18 PM CST.
36 Metadata cache created.
37 Last metadata expiration check: 0:00:18 ago on Sun 17 Sep 2023 07:26:18 PM CST.
38 Dependencies resolved.
39 Nothing to do.
40 Complete!
41 Last metadata expiration check: 0:00:25 ago on Sun 17 Sep 2023 07:26:18 PM CST.
42 Dependencies resolved.
43 Nothing to do.
44 Complete!
45 Last metadata expiration check: 0:00:32 ago on Sun 17 Sep 2023 07:26:18 PM CST.
46 Dependencies resolved.
47 Nothing to do.
48 Complete!
49 Last metadata expiration check: 0:00:38 ago on Sun 17 Sep 2023 07:26:18 PM CST.
50 Dependencies resolved.
51 Nothing to do.
52 Complete!
53 -- update end --
54 
55 [wit@fedora null]$ 
56 [wit@fedora null]$ 

 

 

 

 

三、参考资料:

 

  1、Linux之sudo自动输入密码   https://www.cnblogs.com/kn-zheng/p/17464033.html

posted on 2023-08-11 17:05  lnlidawei  阅读(75)  评论(0编辑  收藏  举报