Check that file exists

This commit is contained in:
Bob Mottram 2016-10-01 15:08:02 +01:00
parent 88f0c36f44
commit ff95d79d26
1 changed files with 6 additions and 4 deletions

View File

@ -107,10 +107,12 @@ function add_onion_service {
onion_address=$(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
# Record the domain in the completion file
if ! grep "${onion_service_name} onion domain" $COMPLETION_FILE; then
echo "${onion_service_name} onion domain:${onion_address}" >> $COMPLETION_FILE
else
sed -i "s|${onion_service_name} onion domain.*|${onion_service_name} onion domain:${onion_address}|g" $COMPLETION_FILE
if [ -f $COMPLETION_FILE ]; then
if ! grep "${onion_service_name} onion domain" $COMPLETION_FILE; then
echo "${onion_service_name} onion domain:${onion_address}" >> $COMPLETION_FILE
else
sed -i "s|${onion_service_name} onion domain.*|${onion_service_name} onion domain:${onion_address}|g" $COMPLETION_FILE
fi
fi
echo $onion_address