[CENTOS] Output a list of cron settings for all users.

Overview

Cron is a daemon process for the task scheduler that runs on Unix-like servers. Since the cron settings (task schedule) can be set for each user, it takes a lot of time to issue the bash command to check all the settings in the server.

command

# 1.Move to administrator privileges
su -
# 2.Output cron settings for each user
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done
# 3.Get out of administrator privileges
exit

Commentary

Each part of the command 2 has the following processing contents.

/etc/passwd


 The content is divided by the delimiter ":" on each line of the password file "/ etc / passwd", and the value of the first item (user name) is extracted.

``` $(○○○) ```
 Execute and expand the command.

``` for ××× in △△△; do □□□; done ```
 Each item of △△△ is stored in XXX and the processing of □□□ is executed.

``` echo $××× ```
 Output the contents of XXX. (The user name is output in this command)

``` crontab -u $××× -l ```
 Output cron settings for xxx users.

# reference
 * [Display a list of cron jobs for all users --Qiita](https://qiita.com/ironsand/items/fb05869080f6ed724816)
* [unix - How do I list all cron jobs for all users? - Stack Overflow](https://stackoverflow.com/questions/134906/how-do-i-list-all-cron-jobs-for-all-users)

# Remarks
 This article is a migration article from the blog "[Technical Notes for Chores Engineers](https://scrapbox.io/nezuq/)". The previous blog will be deleted.



Recommended Posts

Output a list of cron settings for all users.
A list of rawValues for UITextContentType.
Get a list of MBean information for Java applications
Initial settings of Netbeans (for JavaEE)
Sort a List of Java objects
How to output a list of strings in JSF as comma-separated strings
List of alternative distributions for CentOS
Get a list of S3 files with ListObjectsV2Request (AWS SDK for Java)
List of point cuts for making finer point cuts
List of download destinations for oracle java
Ability to display a list of products
Get a list of Qiita articles for a specific user with Ruby + Qiita API v2
[Personal memo] A small story about CPUs settings of Docker Desktop for Windows
Do you use the for statement after all? Do you use a while statement? Proper use of for statement and while statement
A brief summary of Bootstrap features for beginners
Summary of Java environment settings for myself [mac]
List of libraries useful for ios application development
A collection of simple questions for Java beginners
[Java] Let's create a mod for Minecraft 1.14.4 [99. Mod output]
Awareness of object-oriented programming for half a year