Calculate Time Duration using Ubuntu Script

First create your script file

$ touch script.sh

$ chmod a+x script.sh

Copy below code to script.sh.

#!/bin/bash
start=$(($(date +%s%N)/1000000))
echo "Hello, World"
sleep 5
end=$(($(date +%s%N)/1000000))
echo "Start: " $start
echo "End: "$end
echo "Time (Milliseconds): " $(($end-$start))
echo "Time (Seconds): " $((($end-$start)/1000))

Now run your script file.
$ ./script.sh

You have done

Advertisements

DbSchema Tool to generate ERD for Postgresql

Installing DbSchema on Linux

$ wget http://www.dbschema.com/DbSchema.zip
$ unzip DbSchema.zip
$ cd DbSchema
$ chmod +x DbSchema.sh

To run DbSchema

$ ./DbSchema.sh

 

To Enable Remote Computer Access:

Step 1: # vi /etc/postgresql/9.1/main/pg_hba.conf

. . . . add line for your host to give access to 172.16.30.0/24 network. (Note: 0 = *)

. . . . host    all             all             172.16.30.0/24         trust

Step 2: # vi /etc/postgresql/9.1/main/postgresql.conf

. . . . Next set IP address(es) to listen on

. . . . listen_addresses='*'

. . . . Bind and open TCP/IP port by setting tcpip_socket to true

. . . .tcpip_socket = true

Step 3: Restart PostgesSQL Server
# /etc/init.d/postgresql restart

Step 4: Stop Firewall

# ufw disable

 

You have done..