Articles in this section

The PHP session cleaner cron task in Plesk fails: run-parts: /etc/cron.hourly/plesk-php-cleanuper exited with return code 1

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • Plesk Administrator regularly receives email notifications about the failed plesk-php-cleanuper cron task:

    CONFIG_TEXT: Subject: cd / && run-parts --report /etc/cron.daily
    Message text: run-parts: /etc/cron.hourly/plesk-php-cleanuper exited with return code 1

  • Manual execution of the /etc/cron.hourly/plesk-php-cleanuper task stops after an operation with the /var/lib/php/sessions/ directory:

    # sh -x /etc/cron.hourly/plesk-php-cleanuper
    + [ -e /etc/cron.d/php -a -x /usr/lib/php/sessionclean ]
    + pgrep -f .*/etc/cron.daily/plesk-php-cleanuper$
    + grep -qv 15249
    + renice 19 -p 15249
    + [ -x /usr/lib/plesk-9.0/maxlifetime ]
    + [ -d /var/lib/php/sessions ]

    The exit code of this command is 1:

    # echo $?
    1

Cause

The cron script fails to execute becase /var/lib/php/sessions and /var/lib/php directories are missing on the server:

# ls -la /var/lib/php
ls: cannot access '/var/lib/php': No such file or directory
# ls -la /var/lib/php/sessions
ls: cannot access '/var/lib/php/sessions': No such file or directory

Resolution

  1. Connect to the server via SSH.

  2. Create missing /var/lib/php and /var/lib/php/sessions directories:

    # mkdir /var/lib/php
    # mkdir /var/lib/php/sessions

  3. Set the correct permissions for these directories:

    # chmod 755 /var/lib/php
    # chmod 1733 /var/lib/php/sessions

To verify the execution of the `plesk-php-cleanuper` cron task
  • Execute the task manually:

    # sh -x /etc/cron.hourly/plesk-php-cleanuper

  • After the execution is finished, check the exit code. It should be 0 which means success:

    # echo $?
    0

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.