Creating a shell script to modify and / or create bookmarks in firefox

I have several applications that change IP addresses every time they are deployed.

I am wondering how can I create a bash shell script

  • Modify / Update Existing Firefox Bookmarks
  • If bookmarks do not exist, create them.

After some research, I found that I need to change places.sqlite, so I downloaded sqlite. I looked at the diagram and I think that moz_places and moz_bookmarks are what I need to insert, but I'm not sure. If yes, then how to connect identifiers, if I need 2 separate inserts. I already have a way to get a new IP address for each new deployment, so I just bind it to a variable.

My use case looks something like this:

Deployment 1: URL: 192.168.1.**10**/app1
Deployment 2: URL: 192.168.1.**20**/app1

Brownie indicates if I can create multiple 1st folders and insert bookmarks inside them. For example {Folder # 1: app1, app2}, {Folder # 2: app3}, {Folder # 3: app4, app5, app6}.

+4
source share
1 answer

A shell script may not be the best tool for this problem; but you can use a script like this to redirect the browser to a new location each time you redeploy the application and mark localhost:<port>:

#!/bin/bash

# redirect localhost:<port> to another address with HTML                                                                

local_port="${1:?provide local port to listen on}"                                                                 
redirect="${2:?provide application ip address}"                                                      

while :; do                                                                     
  (                                                                             
    echo "HTTP/1.1 200 OK"                                                      
    echo ""                                                                     
    echo "<head>"
    echo "  <meta http-equiv=\"refresh\" content=\"0; url=$redirect\" />"
    echo "</head>"
    echo ""                                                                     
  ) | ncat -l -p "$local_port" > /dev/null                                               

done 

localhost:8000 Firefox script . script ; . script, , .

$ bash redirect.sh 8000 192.168.1.10/app1
$ bash redirect.sh 8001 192.168.1.11/app1
0

All Articles