Crontab emails

The mail sent by your server’s cron jobs are refused by the recipient server due to:

"Action: failed
Final-Recipient: user;
Status: 5.0.0
Remote-MTA: dns;
Diagnostic-Code: smtp; 553 5.1.8 ... Domain of sender address does not exist"

Crontab will by default send from $LINUX_USER@$HOSTNAME. You can change this by connecting to the server via SSH, running “crontab -e”, and adding “MAILFROM=VALID_ADDRESS_HERE”. Ideally, the MAILFROM will be set to a mail account hosted on your server, but if it is a valid domain, the recipient address will accept it.

PHP Sessions causing Error

Currently your messages log is filling up with errors and the system is unstable. Check the message log:

$ server# tail -f /var/log/messages
Jul 28 08:57:30 mail kernel: EXT4-fs warning (device sda3): ext4_dx_add_entry: Directory index full!

Check the sessions directory

 $ server# php -i | grep session.save_path
session.save_path => /var/lib/php/session => /var/lib/php/session

$ server# du -shcx /var/lib/php/session
1000.0M    /var/lib/php/session
1000.0M    total

A cron job similar to the following ran every day, or periodically, should prevent those files from accumulating.

# find /var/lib/php/session -type d -mtime -15 -delete


# find /var/lib/php/session -depth -mindepth 1 -maxdepth 1 -type f -cmin +120 -delete;

Cron Job not working in Plesk Domain

Check you cron job. Make sure the path are okay.

This is likely due to Plesk using a chrooted environment. The user that is executing the script doesn’t have access to PHP. You have a few options:

1. Add PHP to the user’s chroot –
2. Disable the chrooted environment entirely –
3. Run the script as root because root does have access to PHP (not recommended but if the script is trusted it might be ok).

Show Cron Jobs

How do I view currently setup or all running cron jobs under Linux operating systems?

The cron service searches its spool area (usually /var/spool/cron/crontabs) for crontab files (which are named after user accounts); crontabs found are loaded into memory. cron also reads /etc/crontab, which is in a slightly different format. Additionally, cron reads the files in /etc/cron.d: it treats the files in /etc/cron.d as in the same way as the /etc/crontab file. The intended purpose of /etc/cron.d/ directory feature is to allow packages that require finer control of their scheduling than the /etc/cron.{daily,weekly,monthly} directories to add a crontab file to /etc/cron.d.View Users Cronjob

Use the following syntax to view username users cronjob:

crontab -u userName -l
crontab -u username -l

View Root User Cronjob

Just type the following command:

crontab -l

View /etc/crontab

A cronjob can be also run from /etc/crontab file. To view it, enter:

# less /etc/crontab

View Daily Cronjob

Type the following commands:

cd /etc/cron.daily/
ls -l
cat filename

View Hourly Cronjobs

Type the following commands:

cd /etc/cron.hourly/
ls -l
cat filename

View Weekly Cronjobs

Type the following commands:

cd /etc/cron.weekly/
ls -l
cat filename

View Monthly Cronjobs

Type the following commands:

cd /etc/cron.monthly/
ls -l
cat filename

View Software (Package) Specific Cronjobs

Type the following commands

cd /etc/cron.d/
ls -l
cat filename