0

I am trying to setup a crontab to execute a command from a specific user.

Here is my code in "crontab -e". Why is this not working ?

 */5 * * * *   user /home/user/whoami>swag.txt

I am running ubuntu14.

EDIT: I am using a personal crontab. I am running whoami>swag.txt to test what user is running the crontab.

This is my new crontab.

 */5 * * * *   ./whoami>swag.txt

I am now not seeing anything in swag.txt

Narayana
  • 1
  • 3

1 Answers1

0

If this is your "personal" crontab (unlike those in /etc/cron.*/) then you must not include a user field; cron is now trying to run the command named "user" every 5 minutes with parameters "/home/user/whoami > swag.txt".

Note also that if you don't trust the current working directory to be your home directory (as you've specified the full path to the command instead of plain ./) then you should also specify the full path to the output file swag.txt.

wurtel
  • 3,806
  • 12
  • 15