Linux scheduled task crontab is not effective

After using the command "service crond status" to check, the following information appears: "Cron: pam_unix (cron:session): session opened/closed for user root by (uid=0)".

This is because cron can run at a configured interval. When cron performs this operation, it usually runs as the root user, creating a session for the specified user.

To make the necessary modifications:

  1. Go to the directory /etc/pam.d.

  2. Open the file named common-session-noninteractive.

  3. Search for the content "session required" (usually at the end).

  4. Above this line, add the following:

session [success=1 default=ignore] service in cron quiet use_uid

  1. Save and exit the file.

  2. Restart the crond service (or cron for Ubuntu).

Now you can give it a try, and it should work.

For example, "". If someone replies to you it will be via email.
For example, ""