multiple server in one bash script

Table of Contents

1. spawn terminal

gnome-terminal — mongod
gnome-terminal — redis-server
gnome-terminal — sudo service mysql start

2. detach process

This will start 3 servers one after another and have all running in the background

#!/usr/bin/env bash

~/Application/repo/activitywatch/aw-server/aw-server &
~/Application/repo/activitywatch/aw-watcher-afk/aw-watcher-afk &
~/Application/repo/activitywatch/aw-watcher-window/aw-watcher-window &
  • in this stack exchange post
  • && only start the first server(maybe because it does not return stuff, or does not return 0)

frame-title-format

Backlinks

bash

#!/bin/bash
cd ~/Dropbox/Notes/RoamNotes
array=()
filtered_array=()
mapfile -d $'\0' array < <(find . -print0 )

for (( i=0; i<${#array[@]}; i+=1 )); do
filtered_array+=$(stat "${array[$i]}")
done



echo ${array[2]}
echo ${filtered_array[2]}

Author: Linfeng He

Created: 2024-04-05 Fri 02:23