Answer the question
In order to leave comments, you need to log in
Issues with wget in bash script from cron
Good day.
It was necessary to periodically execute the script that worked before manually.
0 */3 * * * root /usr/local/etc/postfix/out/fresh-maps.sh
I placed the fresh-maps.sh script in the /etc/crontab file :
#!/usr/local/bin/bash
USER=login
PASSWORD=pass
DATE=`date "+_%m-%d_%H"`
if [ -s /usr/local/etc/postfix/maps_recipient ] ; then
cd /usr/local/etc/postfix/out/
rm -f /usr/local/etc/postfix/out/maps_recipient
wget --quiet --user=$USER --password=$PASSWORD http://192.168.5.25/postfix/pgg/maps_recipient
if [ -s /usr/local/etc/postfix/out/maps_recipient ] ; then
mv /usr/local/etc/postfix/maps_recipient /usr/local/etc/postfix/old/maps_recipient$DATE
cp /usr/local/etc/postfix/out/maps_recipient /usr/local/etc/postfix/maps_recipient
postmap /usr/local/etc/postfix/maps_recipient
fi
fi
Answer the question
In order to leave comments, you need to log in
Thank you all . Debugging, described by Comrade. sledopit paid off. Everywhere replaced with full paths and double-checked the rights to the files.
Everything is working.
1. Specify the full path to wget
/usr/bin/wget
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
well, if it’s exactly vget - tell him where to write the file - apparently, he does not have write permissions somewhere
and I would also advise you to use the full paths to the commands both in the script and in the cron - sh /usr/local/…
does the script have execution permissions?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question