统信UOS1060设置自动关机01

254 篇文章 3 订阅
254 篇文章 4 订阅

原文链接:统信UOS1060设置自动关机01
hello,大家好啊,今天给大家介绍一篇如何在统信UOS 1060上实现自动关机的文章,本篇文章采用两种方式,第一种使用的是crontab定时任务的方式,第二种是使用at命令的方式,两种方式供您选择。
方法一:使用crontab定时任务

1、编辑crontab文件,设置每天14:09关机

uos@uos-PC:~/Desktop$ sudo -i
请输入密码:
验证成功
root@uos-PC:~# crontab -e
no crontab for root - using an empty one

Select an editor.  To change later, run 'select-editor'.
  1. /bin/nano        <---- easiest
  2. /usr/bin/vim.basic
  3. /usr/bin/vim.tiny

Choose 1-3 [1]: 2
crontab: installing new crontab
root@uos-PC:~# 
root@uos-PC:~# crontab -l
# Edit this file to introduce tasks to be run by cron.
# 
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
# 
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').
# 
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# 
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# 
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# 
# For more information see the manual pages of crontab(5) and cron(8)
# 
# m h  dom mon dow   command
09 14 * * * /sbin/poweroff
root@uos-PC:~# 

image.png
image.png
2、等到14:09设备关机
image.png

方法二:使用at命令来设置一次性的关机任务
1、安装at命令

uos@uos-PC:~/Desktop$ sudo apt install at -y
请输入密码:
验证成功
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  exim4-base exim4-config exim4-daemon-light guile-2.2-libs libfl2 libgsasl7 libkyotocabinet16v5
  libmailutils5 libntlm0 mailutils mailutils-common
建议安装:
  exim4-doc-html | exim4-doc-info eximon4 spf-tools-perl swaks mailutils-mh mailutils-doc
下列【新】软件包将被安装:
  at exim4-base exim4-config exim4-daemon-light guile-2.2-libs libfl2 libgsasl7 libkyotocabinet16v5
  libmailutils5 libntlm0 mailutils mailutils-common
升级了 0 个软件包,新安装了 12 个软件包,要卸载 0 个软件包,有 116 个软件包未被升级。
需要下载 9,660 kB 的归档。
解压缩后会消耗 56.2 MB 的额外空间。
获取:1 https://professional-packages.chinauos.com/desktop-professional eagle/main arm64 libfl2 arm64 2.6.4-6.2 [103 kB]
获取:2 https://professional-packages.chinauos.com/desktop-professional eagle/main arm64 at arm64 3.1.23-1 [48.0 kB]
获取:3 https://professional-packages.chinauos.com/desktop-professional eagle/main arm64 exim4-config all 4.92.3-8+deb10u7 [325 kB]
获取:4 https://professional-packages.chinauos.com/desktop-professional eagle/main arm64 exim4-base arm64 4.92.3-8+deb10u7 [1,136 kB]
获取:5 https://professional-packages.chinauos.com/desktop-professional eagle/main arm64 exim4-daemon-light arm64 4.92.3-8+deb10u7 [533 kB]
获取:6 https://professional-packages.chinauos.com/desktop-professional eagle/main arm64 guile-2.2-libs arm64 2.2.4+1-2+deb10u1 [4,941 kB]
获取:7 https://professional-packages.chinauos.com/desktop-professional eagle/main arm64 libntlm0 arm64 1.5-1+deb10u1+rebuild [23.6 kB]
获取:8 https://professional-packages.chinauos.com/desktop-professional eagle/main arm64 libgsasl7 arm64 1.8.0-8+b2 [198 kB]
获取:9 https://professional-packages.chinauos.com/desktop-professional eagle/main arm64 libkyotocabinet16v5 arm64 1.2.76-4.2+b1 [267 kB]
获取:10 https://professional-packages.chinauos.com/desktop-professional eagle/main arm64 mailutils-common all 1:3.5-4+rebuild [689 kB]
获取:11 https://professional-packages.chinauos.com/desktop-professional eagle/main arm64 libmailutils5 arm64 1:3.5-4+rebuild [829 kB]
获取:12 https://professional-packages.chinauos.com/desktop-professional eagle/main arm64 mailutils arm64 1:3.5-4+rebuild [567 kB]
已下载 9,660 kB,耗时 9(1,022 kB/s)                                                                       
正在预设定软件包 ...
正在选中未选择的软件包 libfl2:arm64。
(正在读取数据库 ... 系统当前共安装有 207780 个文件和目录。)
准备解压 .../00-libfl2_2.6.4-6.2_arm64.deb  ...
正在解压 libfl2:arm64 (2.6.4-6.2) ...
/var/cache/apt/archives/libfl2_2.6.4-6.2_arm64.deb
正在选中未选择的软件包 at。
准备解压 .../01-at_3.1.23-1_arm64.deb  ...
正在解压 at (3.1.23-1) ...
/var/cache/apt/archives/at_3.1.23-1_arm64.deb
正在选中未选择的软件包 exim4-config。
准备解压 .../02-exim4-config_4.92.3-8+deb10u7_all.deb  ...
正在解压 exim4-config (4.92.3-8+deb10u7) ...
/var/cache/apt/archives/exim4-config_4.92.3-8+deb10u7_all.deb
正在选中未选择的软件包 exim4-base。
准备解压 .../03-exim4-base_4.92.3-8+deb10u7_arm64.deb  ...
正在解压 exim4-base (4.92.3-8+deb10u7) ...
/var/cache/apt/archives/exim4-base_4.92.3-8+deb10u7_arm64.deb
正在选中未选择的软件包 exim4-daemon-light。
准备解压 .../04-exim4-daemon-light_4.92.3-8+deb10u7_arm64.deb  ...
正在解压 exim4-daemon-light (4.92.3-8+deb10u7) ...
/var/cache/apt/archives/exim4-daemon-light_4.92.3-8+deb10u7_arm64.deb
正在选中未选择的软件包 guile-2.2-libs:arm64。
准备解压 .../05-guile-2.2-libs_2.2.4+1-2+deb10u1_arm64.deb  ...
正在解压 guile-2.2-libs:arm64 (2.2.4+1-2+deb10u1) ...
/var/cache/apt/archives/guile-2.2-libs_2.2.4+1-2+deb10u1_arm64.deb
正在选中未选择的软件包 libntlm0:arm64。
准备解压 .../06-libntlm0_1.5-1+deb10u1+rebuild_arm64.deb  ...
正在解压 libntlm0:arm64 (1.5-1+deb10u1+rebuild) ...
/var/cache/apt/archives/libntlm0_1.5-1+deb10u1+rebuild_arm64.deb
正在选中未选择的软件包 libgsasl7。
准备解压 .../07-libgsasl7_1.8.0-8+b2_arm64.deb  ...
正在解压 libgsasl7 (1.8.0-8+b2) ...
/var/cache/apt/archives/libgsasl7_1.8.0-8+b2_arm64.deb
正在选中未选择的软件包 libkyotocabinet16v5:arm64。
准备解压 .../08-libkyotocabinet16v5_1.2.76-4.2+b1_arm64.deb  ...
正在解压 libkyotocabinet16v5:arm64 (1.2.76-4.2+b1) ...
/var/cache/apt/archives/libkyotocabinet16v5_1.2.76-4.2+b1_arm64.deb
正在选中未选择的软件包 mailutils-common。
准备解压 .../09-mailutils-common_1%3a3.5-4+rebuild_all.deb  ...
正在解压 mailutils-common (1:3.5-4+rebuild) ...
/var/cache/apt/archives/mailutils-common_1%3a3.5-4+rebuild_all.deb
正在选中未选择的软件包 libmailutils5:arm64。
准备解压 .../10-libmailutils5_1%3a3.5-4+rebuild_arm64.deb  ...
正在解压 libmailutils5:arm64 (1:3.5-4+rebuild) ...
/var/cache/apt/archives/libmailutils5_1%3a3.5-4+rebuild_arm64.deb
正在选中未选择的软件包 mailutils。
准备解压 .../11-mailutils_1%3a3.5-4+rebuild_arm64.deb  ...
正在解压 mailutils (1:3.5-4+rebuild) ...
/var/cache/apt/archives/mailutils_1%3a3.5-4+rebuild_arm64.deb
正在设置 libkyotocabinet16v5:arm64 (1.2.76-4.2+b1) ...
正在设置 libntlm0:arm64 (1.5-1+deb10u1+rebuild) ...
正在设置 mailutils-common (1:3.5-4+rebuild) ...
正在设置 libfl2:arm64 (2.6.4-6.2) ...
正在设置 exim4-config (4.92.3-8+deb10u7) ...
Adding system-user for exim (v4)
正在设置 guile-2.2-libs:arm64 (2.2.4+1-2+deb10u1) ...
正在设置 exim4-base (4.92.3-8+deb10u7) ...
exim: DB upgrade, deleting hints-db
正在设置 at (3.1.23-1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/atd.service → /lib/systemd/system/atd.service.
正在设置 libgsasl7 (1.8.0-8+b2) ...
正在设置 exim4-daemon-light (4.92.3-8+deb10u7) ...
Initializing GnuTLS DH parameter file
正在设置 libmailutils5:arm64 (1:3.5-4+rebuild) ...
正在设置 mailutils (1:3.5-4+rebuild) ...
update-alternatives: 使用 /usr/bin/frm.mailutils 来在自动模式中提供 /usr/bin/frm (frm)
update-alternatives: 使用 /usr/bin/from.mailutils 来在自动模式中提供 /usr/bin/from (from)
update-alternatives: 使用 /usr/bin/messages.mailutils 来在自动模式中提供 /usr/bin/messages (messages)
update-alternatives: 使用 /usr/bin/movemail.mailutils 来在自动模式中提供 /usr/bin/movemail (movemail)
update-alternatives: 使用 /usr/bin/readmsg.mailutils 来在自动模式中提供 /usr/bin/readmsg (readmsg)
update-alternatives: 使用 /usr/bin/dotlock.mailutils 来在自动模式中提供 /usr/bin/dotlock (dotlock)
update-alternatives: 使用 /usr/bin/mail.mailutils 来在自动模式中提供 /usr/bin/mailx (mailx)
正在处理用于 systemd (241.52-deepin1) 的触发器 ...
正在处理用于 man-db (2.8.5-2) 的触发器 ...
正在处理用于 libc-bin (2.28.23-deepin1) 的触发器 ...
uos@uos-PC:~/Desktop$ 

image.png
2、输入at命令,在指定时间关机

uos@uos-PC:~/Desktop$ sudo -i
请输入密码:
验证成功
root@uos-PC:~# 
root@uos-PC:~# echo "poweroff" | at 14:25
warning: commands will be executed using /bin/sh
job 3 at Thu Sep 28 14:25:00 2023
root@uos-PC:~# 

image.png

3、系统已经关机
image.png

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

鹏大圣运维

编写不易,还请支持

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值