diff --git a/src/freedombone-client b/src/freedombone-client index f7f3e4ce..02a9cbe5 100755 --- a/src/freedombone-client +++ b/src/freedombone-client @@ -95,12 +95,16 @@ function refresh_gpg_keys { fi sudo cp /etc/crontab ~/temp_crontab sudo chown "$CURR_USER":"$CURR_GROUP" ~/temp_crontab - 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 - sudo cp ~/temp_crontab /etc/crontab - sudo chown root:root /etc/crontab + if [ -f ~/temp_crontab ]; then + 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 + sudo cp ~/temp_crontab /etc/crontab + sudo chown root:root /etc/crontab + fi + fi + rm ~/temp_crontab fi - rm ~/temp_crontab } # see https://stribika.github.io/2015/01/04/secure-secure-shell.html