I'm running PHP 5.6 on an Debian 8 machine and hence there is a cronjob running as root for cleaning up session data:

09,39 * * * * root [ -x /usr/lib/php5/sessionclean ] && /usr/lib/php5/sessionclean

Did not even know I had this cronjob until last week when I started to get mails regarding this cronjob saying:

/bin/sh: 1: root: not found

When I try to run the above commands the command starting with "-x" fails:

-bash: -x: command not found

What does the -x in

[ -x /usr/lib/php5/sessionclean ]

mean? Any idea why I'm getting this error/mail?

  • Which cron do you use? User (via crontab -e) or system (in /etc/crontab or /etc/cron.)?
    – rush
    May 20, 2019 at 11:34
  • I can view/edit the cronjob via "sudo crontab -e" or by logging in as root and "crontab -e". May 20, 2019 at 11:43

1 Answer 1


Unless you're using the system-wide crontab /etc/crontab, there is no user field:

Sample user crontab file:

# Edit this file to introduce tasks to be run by cron.
# For more information see the manual pages of crontab(5) and cron(8)
# m h  dom mon dow   command

As you can see the user field is missing.

The -x tests if file /usr/lib/php5/sessionclean exists and is executable. Without the username field you could also write:

09,39 * * * * test -x /usr/lib/php5/sessionclean && /usr/lib/php5/sessionclean

But your version should work as well without username field.

  • The file /etc/crontab does not contain the job/command, so I guess I'm not using the system-wide crontab... I removed the username and now it seems to work. At least I'm not getting any mails indicating otherwise. But why did the job/command stop working? It has been working for two years (system install date) and the job/command was created by Apache/PHP/Debian (don't know which one actually creates the cronjob). May 21, 2019 at 4:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .