Bläddra i källkod

Check that file exists

Bob Mottram 8 år sedan
förälder
incheckning
ff95d79d26
1 ändrade filer med 6 tillägg och 4 borttagningar
  1. 6
    4
      src/freedombone-utils-onion

+ 6
- 4
src/freedombone-utils-onion Visa fil

107
     onion_address=$(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
107
     onion_address=$(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
108
 
108
 
109
     # Record the domain in the completion file
109
     # Record the domain in the completion file
110
-    if ! grep "${onion_service_name} onion domain" $COMPLETION_FILE; then
111
-        echo "${onion_service_name} onion domain:${onion_address}" >> $COMPLETION_FILE
112
-    else
113
-        sed -i "s|${onion_service_name} onion domain.*|${onion_service_name} onion domain:${onion_address}|g" $COMPLETION_FILE
110
+    if [ -f $COMPLETION_FILE ]; then
111
+        if ! grep "${onion_service_name} onion domain" $COMPLETION_FILE; then
112
+            echo "${onion_service_name} onion domain:${onion_address}" >> $COMPLETION_FILE
113
+        else
114
+            sed -i "s|${onion_service_name} onion domain.*|${onion_service_name} onion domain:${onion_address}|g" $COMPLETION_FILE
115
+        fi
114
     fi
116
     fi
115
 
117
 
116
     echo $onion_address
118
     echo $onion_address