首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

如何列出所有用户的所有cron作业?

要列出所有用户的所有cron作业,您可以使用以下方法:

  1. 使用 crontab 命令列出当前用户的所有cron作业:
代码语言:txt
复制
crontab -l
  1. 使用 grep 命令查找 /var/spool/cron/crontabs 目录下的所有cron作业:
代码语言:txt
复制
grep -r "^[^#]*" /var/spool/cron/crontabs
  1. 使用 find 命令查找 /etc/cron.d 目录下的所有cron作业:
代码语言:txt
复制
find /etc/cron.d -type f -exec cat {} \;
  1. 使用 lscat 命令查找 /etc/cron.daily/etc/cron.hourly/etc/cron.monthly/etc/cron.weekly 目录下的所有cron作业:
代码语言:txt
复制
ls -l /etc/cron.daily /etc/cron.hourly /etc/cron.monthly /etc/cron.weekly
cat /etc/cron.daily/* /etc/cron.hourly/* /etc/cron.monthly/* /etc/cron.weekly/*

请注意,这些方法可能需要管理员权限才能执行。如果您没有管理员权限,请与系统管理员联系以获取所需的权限。

页面内容是否对你有帮助?
有帮助
没帮助

相关·内容

setuid与setgid

/etc/crontab文件和crontab -e命令区别 1、格式不同 前者 # For details see man 4 crontabs # Example of job definition: # .—————- minute (0 - 59) # | .————- hour (0 - 23) # | | .———- day of month (1 - 31) # | | | .——- month (1 - 12) OR jan,feb,mar,apr … # | | | | .—- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed 后者 #50 1 * * * command 2、使用范围 修改/etc/crontab这种方法只有root用户能用,这种方法更加方便与直接直接给其他用户设置计划任务,而且还可以指定执行shell等等, crontab -e这种所有用户都可以使用,普通用户也只能为自己设置计划任务。然后自动写入/var/spool/cron/usename 3.服务重启 1 /etc/init.d/crond restart 2 service crond restart

01
领券