Crontab als anderer Benutzer

Crontab als anderer Benutzer

Ich führe crontab als Root-Benutzer aus:

screen -S konsola -X stuff 'say hello'`echo -ne '\015'`

Wie führe ich es als Benutzer „niemand“ aus? Nur dieser Benutzer hat einen Bildschirm mit der angegebenen PID, deshalb brauche ich ihn.

Antwort1

Können Sie crontab -u nobody -eIhren Befehl nicht einfach zur Crontab von niemandem hinzufügen?

Andernfalls würde ich einfach dies in die Root-Crontab einfügen:

su nobody -c "screen -S konsola -X stuff 'say hello'`echo -ne '\015'`"

Aus der Manpage:

The su command is used to become another user during a login session.
[...]
 -c, --command  COMMAND
    Specify a command that will be invoked by the shell using its -c.

verwandte Informationen