Change ownership if file exists

This commit is contained in:
Bob Mottram 2018-04-07 18:40:48 +01:00
parent d1535c71ea
commit d3057a6db3
1 changed files with 1 additions and 1 deletions

View File

@ -94,8 +94,8 @@ function refresh_gpg_keys {
fi
fi
sudo cp /etc/crontab ~/temp_crontab
sudo chown "$CURR_USER":"$CURR_GROUP" ~/temp_crontab
if [ -f ~/temp_crontab ]; then
sudo chown "$CURR_USER":"$CURR_GROUP" ~/temp_crontab
if grep -q 'test' ~/temp_crontab; then
if ! grep -q 'gpg --refresh-keys' ~/temp_crontab; then
echo "0 */$REFRESH_GPG_KEYS_HOURS * * * $CURR_USER /usr/bin/gpg --refresh-keys > /dev/null" >> ~/temp_crontab