I am trying to execute the message in a specific time interval for every user that logs in to their root

  • duplicate of "how do i really annoy all logged in users because my message is way more important than their work"? – cas Nov 6 '15 at 10:41

There are a few ways to do this:

  • use wall to broadcast a message to logged-in users. This has the drawback that it is sent even if they are editing a file. You can schedule that using cron, e.g., this entry in root's crontab:

    * 0 * * * wall /etc/motd

  • if they happen to be using bash (and if you have control over their configuration), the bash prompt can execute shell functions via PROMPT_COMMAND.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.