Archive for the tag 'crontab'

Shell description is missed in crontab files after migration.

After the migration to the Parallels Plesk Panel 10.x, the cron jobs are not executed by chrootsh.

The SHELL value in the crontab is not copied from the target to the destination server during the migration. Say, servers A and B are configured to use chroot shell. When migrating a customer account with crontab and the SHELL value is omitted:

To resolve this issue, Determine the path to the chrootsh utility with the following command:

# grep chroot /etc/shells

Add the SHELL value to the crontab with the command:

# /usr/local/psa/bin/server_pref -u -crontab-secure-shell

Reference : http://parallels.com

Checking cpanel crontab user files.

Via root SSH access, either of the following commands may be used to list the contents:

# crontab -l -u username
# cat /var/spool/cron/username

usage: crontab

usage: crontab [-u user] file

crontab [-u user] { -e | -l | -r }
-e (edit user’s crontab)
-l (list user’s crontab)
-r (delete user’s crontab)
-i (prompt before deleting user’s crontab)

How do I keep my crontab from sending an email every time it runs?

Add the following > /dev/null 2>&1

0 * * * * /home/user/backup.pl >/dev/null 2>&1

The >> /dev/null 2>&1 part means to send any standard output to /dev/null (the linux trash can) and to redirect standard error (2) to the same place as the standard output (1). Basically it runs the command without any output to a terminal etc.

>/dev/null 2>&1

If you wanted to save the output of a certain command you can replace the “>> /dev/null 2>&1″ with “>> /home/user/script.log 2>&1″