How to check cronjob mail using cmd
To check the cron job mail using the command line, you can use the following commands:
Method 1: Using mail
command
- Open a terminal or command prompt.
- Type
mail
and press Enter. This will display the mail queue. - Look for the cron job mail by searching for the word "cron" or the name of the script that runs the cron job.
- Use the
q
command to quit the mail reader.
Example:
$ mail
> q
Method 2: Using mailq
command
- Open a terminal or command prompt.
- Type
mailq
and press Enter. This will display the mail queue. - Look for the cron job mail by searching for the word "cron" or the name of the script that runs the cron job.
- Use the
q
command to quit the mail reader.
Example:
$ mailq
> q
Method 3: Using less
command
- Open a terminal or command prompt.
- Type
less /var/mail/username
(replaceusername
with your actual username) and press Enter. This will display the mail file. - Search for the cron job mail by pressing
/
and then typing "cron" or the name of the script that runs the cron job. - Use the
q
command to quit the less pager.
Example:
$ less /var/mail/username
Method 4: Using fetchmail
command
- Open a terminal or command prompt.
- Type
fetchmail
and press Enter. This will fetch the mail from the mail server. - Look for the cron job mail by searching for the word "cron" or the name of the script that runs the cron job.
- Use the
q
command to quit the mail reader.
Example:
$ fetchmail
> q
Note: The above commands assume that you are using a Linux or Unix-like system. The commands may vary depending on your operating system and mail server configuration.