Crontab – Run in directory

All jobs are executed by a shell, so start that shell snippet by a command to change the directory.

cd /path/to/directory && ./bin/myapp

Concerning the use of && instead of ;: normally it doesn’t make a difference, but if the cd command fails (e.g. because the directory doesn’t exist) with && the application isn’t executed, whereas with ; it’s executed (but not in the intended directory).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)