[neon/infrastructure/pangea-gemstash] /: log name not path and save timestamped logs

Carlos De Maine null at kde.org
Tue May 30 04:05:34 BST 2023


Git commit e7d2735623f08a2513e3e56e5590e4faa372a2e7 by Carlos De Maine.
Committed on 30/05/2023 at 03:05.
Pushed by carlosdem into branch 'master'.

log name not path and save timestamped logs

M  +1    -1    config.yaml
M  +16   -3    start.sh

https://invent.kde.org/neon/infrastructure/pangea-gemstash/-/commit/e7d2735623f08a2513e3e56e5590e4faa372a2e7

diff --git a/config.yaml b/config.yaml
index 05b42fe..9ced133 100644
--- a/config.yaml
+++ b/config.yaml
@@ -17,4 +17,4 @@
 :bind: unix:///home/gemstash/.gemstash/puma.sock
 :protected_fetch: true
 :fetch_timeout: 10
-:log_file: /home/gemstash/.gemstash/gemstash.log
+:log_file: gemstash.log
diff --git a/start.sh b/start.sh
index 8562983..4162af3 100755
--- a/start.sh
+++ b/start.sh
@@ -18,6 +18,11 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# Define a timestamp function
+timestamp() {
+  date +"%T" # current time
+}
+
 # set up stack for making our own gems
 set -ex
 export GEM_HOME=$(ruby -e 'puts Gem.user_dir')
@@ -36,9 +41,17 @@ gem install bundler --conservative
 gem update bundler
 
 #install the config before we gemstash
-rm -vfr /home/gemstash/.gemstash/
-mkdir -v /home/gemstash/.gemstash/
-cp -vf config.yaml /home/gemstash/.gemstash/config.yaml
+if [ -d "/home/gemstash/.gemstash/" ]
+then
+    echo "~/.gemstash/ exists"
+    rm -vf /home/gemstash/.gemstash/config.yaml
+    mv -v /home/gemstash/.gemstash/gemstash.log /home/gemstash/.gemstash/gemstash.log.$(timestamp)
+else
+    echo "~/.gemstash/ doesn't exist, lets start from the beginning"
+    mkdir -v /home/gemstash/.gemstash/
+    cp -vf config.yaml /home/gemstash/.gemstash/config.yaml
+fi
+
 # install, configure and start gemstash
 gem install gemstash
 #gemstash start --no-daemonize


More information about the Neon-commits mailing list