Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
13
rated 0 times [  13] [ 0]  / answers: 1 / hits: 8407  / 2 Years ago, wed, january 19, 2022, 9:10:55

What does it mean?



(root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null ; -delete)


Found it in system.log.


More From » cron

 Answers
4

You chopped up part of the log line, which would provide more context about what this means.



It would be something like:



syslog:Mar 12 10:17:01 hostname CRON[4154]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null ; -delete)


The fact that it says CRON indicates it was generated by the cron periodic execution daemon. After the colon, you see it executed a command as the root user. The command was the thing in the parentheses after CMD.



When you install PHP it adds a crontab entry to clean up stale sessions, which is run by the crontab daemon. Other than the cron-related information I mentioned, the command itself verifies that /usr/lib/php5/maxlifetime and /var/lib/php5 exist, then uses the find command to locate session files under /var/lib/php5 older than the number contained in /usr/lib/php5/maxlifetime, which it then deletes.



This is the command itself:



[ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null ; -delete


If you want to understand it better, I suggest reading this for the conditions at the beginning:



http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html



then this answer for basics of find:



How can I use find command more efficiently?



If your question is about whether this command is safe, then yes, it's not a security risk of any kind and is perfectly safe to see this run periodically.


[#26551] Friday, January 21, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
untroo

Total Points: 3
Total Questions: 110
Total Answers: 95

Location: Palestine
Member since Thu, Oct 28, 2021
3 Years ago
untroo questions
;