Clear Linux安装Crontab
1. 说明
Clear Linux 默认没有安装 crontab
,需要自己安装并设置。
2. 安装
sudo swupd bundle-add cronie
which crontab
安装成功并输出 /usr/bin/crontab
。
3. 设置
启动并设置开机自启:
sudo systemctl start cronie
sudo systemctl enable cronie
显示以下内容:
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-unit-files ====
Authentication is required to manage system service or unit files.
Authenticating as: name
Password:
==== AUTHENTICATION COMPLETE ====
Created symlink /etc/systemd/system/multi-user.target.wants/cronie.service → /usr/lib/systemd/system/cronie.service.
==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ====
Authentication is required to reload the systemd state.
Authenticating as: name
Password:
==== AUTHENTICATION COMPLETE ====
将当前用户名,加入到cron.allow
:
sudo sh -c "echo $(whoami) >> /etc/cron.allow"
cat /etc/cron.allow
而后,就可编辑和查看命令:
crontab -e
crontab -l