全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 1617|回复: 16
打印 上一主题 下一主题

[疑问] Debian12中的定时怎么设置?

[复制链接]
跳转到指定楼层
1#
发表于 2024-2-3 18:28:57 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

我以前都是使用centos,所以对crontabe懂一些,但是我发现换到debian12之后, apt install cron 或者apt install cronie都安装不上,系统要求使用systemd,请大佬指点,谢谢了

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package corntab
root@ip-:/home/hostloc# apt install corn
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package corn
root@ip-:/home/hostloc# apt install cronie
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package cronie is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  systemd-cron cron-daemon-common cron bcron
推荐
 楼主| 发表于 2024-2-3 19:10:06 | 只看该作者
aru 发表于 2024-2-3 19:07
cron 是分用户的
执行crontab -l 是显示当前用户的定时任务
/etc/crontab 是系统的定时任务,你执行cront ...

谢谢您了
推荐
 楼主| 发表于 2024-2-3 19:05:04 | 只看该作者
aru 发表于 2024-2-3 19:04
no crontab for admin
这句话的意思是admin没有设置定时任务
不是说你的机器没有cron

vi /etc/crontab

任务我是直接写进去的
15#
发表于 2024-2-3 19:07:11 | 只看该作者
Telegramr 发表于 2024-2-3 19:05
vi /etc/crontab

任务我是直接写进去的

cron 是分用户的
执行crontab -l 是显示当前用户的定时任务
/etc/crontab 是系统的定时任务,你执行crontab -l 是不会被显示的

13#
发表于 2024-2-3 19:04:03 | 只看该作者
Telegramr 发表于 2024-2-3 18:53
真的没有
crontab -l
no crontab for admin

no crontab for admin
这句话的意思是admin没有设置定时任务
不是说你的机器没有cron
12#
 楼主| 发表于 2024-2-3 19:03:52 | 只看该作者
谢谢大家的回复

apt install cron*好像安装了一堆包,不知道是不是安装上了。@DKer 的指导,重启的时候没有提示。
systemctl list-units --type=service
好像看到cron.service 服务了
11#
 楼主| 发表于 2024-2-3 19:01:34 | 只看该作者
DKer 发表于 2024-2-3 18:46
直接编辑 /var/spool/cron/crontabs 目录下的文件,保存后 systemctl restart cron 重启一下服务。 ...

谢谢您的回复
10#
 楼主| 发表于 2024-2-3 18:53:44 | 只看该作者
似毛非毛 发表于 2024-2-3 18:44
第一次见没有crontab的debian12。。。

真的没有
crontab -l
no crontab for admin

apt install crontab
apt install cronie
apt install cron

都提示安装不了
9#
 楼主| 发表于 2024-2-3 18:52:15 | 只看该作者

crontab -l
no crontab for admin

想试一下debian新版的,但发现不一样。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2025-11-12 15:55 , Processed in 0.104397 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表