I have a small bash script that uses curl to post the Plesk Apache logs to a logging service and then moves the files to an 'uploaded' directory (so as to not reload them on a second run).
The scripts works fine from an ssh CLI, but fails under cron and so I'm clearly missing a permission for the cron task or similar.
The actual script reads:
This works without issue from an SSH shell, but cron reports:
So both curl and mv seem to be complaining. Do I need to provde a path varialbe or set absolute paths to the commands?
The scripts works fine from an ssh CLI, but fails under cron and so I'm clearly missing a permission for the cron task or similar.
The actual script reads:
Code:
for FILE in access_*log.processed.*.gz
do echo "Processing $FILE"
curl -v -X POST -T $FILE -H 'Content-Encoding: gzip' https://[URL_removed]
mv $FILE uploaded/$FILE
done
This works without issue from an SSH shell, but cron reports:
Code:
Task "/var/www/vhosts/vhost_name/logs/loadAccessLogs.sh" completed with error in 0 seconds, output:
curl: Can't open 'access_*log.processed.*.gz'!
curl: try 'curl --help' or 'curl --manual' for more information
mv: cannot stat ‘access_*log.processed.*.gz’: No such file or directory
So both curl and mv seem to be complaining. Do I need to provde a path varialbe or set absolute paths to the commands?
Last edited: