I need to update the crontab of my web user (the user that is executing all websites). In my crontab I'm using shell script with commands that needs to use "sudo".
The script is well executed but I get error messages, a few examples below :
mv: cannot move 'cms/configs/database.json' to './database.json': Permission denied
mv: cannot move 'cms/configs/options.json' to './options.json': Permission denied
mv: cannot move 'cms/configs/analytics.json' to './analytics.json': Permission denied
mv: cannot move 'cms/sql/patchs.json' to './patchs.json': Permission denied
mv: cannot move 'cms/public/uploads' to './uploads': Permission denied
mv: cannot move 'cms/node_modules' to './node_modules': Permission denied
And I put the crontab declaration using : sudo crontab -u mywebuser -e
If I execute the script without crontab using "sudo myscript.sh" everythings works as expected.