I have created a script
#!/bin/bash
echo "tredor"
If I run it using command line, it works, but when I move it to being a cron job, it doesn't.
In crontab -e
, I entered the following code
*/5 * * * * root ./my_script
I expect to see an output "tredor" every 5 minutes but that is no happening. How can I modify my codes to be able to see output?
crontab -e
and placing root as user in your crontbab will not probably work. Additionally you don't provide the full path to the script, except if you have expanded the path in crontab's file. You can check this question and it's answers here for some cron gotchas. Possible duplicate of askubuntu.com/q/337204/12218?