Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I'm trying to schedule a task to run ever minute using cron:

* * * * * /home/yzm/simple.sh >> /var/log/cron.log

and this returns: bash: yzm: command not found

cd-ing out of that folder:

cd .. * * * * * /home/yzm/simple.sh >> /var/log/cron.log

returns: bash: bin: command not found

I've verified that the script works when just executing over terminal: sh /home/yzm/simple.sh

I'm not sure what I need to do to get this working. Whenever I try to run the crontab command, it seems to just take the first entry in the current directory and output "command not found".

share|improve this question
3  
It sounds like you're trying to run the crontab entry in a terminal, instead of editing the crontab file using crontab -e. So the shell is expanding the *s to list of files and directories (first those in your /home where it finds your home dir then, after you cd .., in /, starting with /bin) and trying to run the list as a sequence of shell commands. –  steeldriver Mar 17 at 22:19
    
@steeldriver I think that should be an answer, really. –  Michael Kjörling Mar 17 at 22:24
    
crontab -l returns: * * * * * /bin/echo "doge" >> /home/yzm/asdf which isnt working as well, so I'm not sure as to how to proceed.. –  Symba Mar 17 at 22:24
    
Does the script have execute perm? –  Adrian Mar 18 at 5:38
    
how should you provide permissions for cron? I don't know if cron properly resolves paths so I try to point directly to the bin to run the command /usr/bin/git it also doesnt seem to have permissions to cd cd /var/www/site –  Symba Mar 18 at 16:47

1 Answer 1

I changed permissions to the script and the script: chmod u+x /path/to/script.sh and was able to execute the script. I'm not sure if it was necessary to change to root user, but I changed to root throughout the process

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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