Search This Blog

Friday, 14 July 2017

Systemd service script example

#sudo vi  /etc/systemd/system/dummy_startup.service

               

[Unit]

Description=startup script


[Service]

ExecStart=/bin/su - ubuntu -c "/bin/bash /home/ubuntu/dummy_startup.sh"


[Install]

WantedBy=multi-user.target


  • Reload the systemctl service to update.

               

sudo systemctl daemon-reload


  • Starting the dummy_startup.service

           

sudo systemctl start dummy_startup.service


  • Checking the Status of Services of the  dummy_startup.service.


sudo systemctl status dummy_startup.service


  • Enabling  dummy_startup.service in runlevel.


sudo systemctl enable dummy_startup.service



Note:

If any changes made after dummy_startup.service file enabled as a service. It's required to reload the daemon by using the command "sudo systemctl daemon-reload"


In case of above solution doesn't fix the issue. It's required to disabled the service using command  "sudo systemctl disable dummy_startup.service" and re-enable it using "sudo systemctl enable dummy_startup.service"


Thursday, 13 July 2017

How to set manual date in linux command

date --set="2 OCT 2006 18:00:00"


[root@ip-172-31-6-98 ec2-user]# ls

dgc_linux_5_0_3-FINAL.sh

[root@ip-172-31-6-98 ec2-user]# rm -rf dgc_linux_5_0_3-FINAL.sh

[root@ip-172-31-6-98 ec2-user]# date

Fri Jul 7 02:36:45 EDT 2017

[root@ip-172-31-6-98 ec2-user]# date --set="6 Jul 2017 02:37:30"

Thu Jul 6 02:37:30 EDT 2017

[root@ip-172-31-6-98 ec2-user]# date

Thu Jul 6 02:37:34 EDT 2017

[root@ip-172-31-6-98 ec2-user]# datehwclock -r

bash: datehwclock: command not found

[root@ip-172-31-6-98 ec2-user]# hwclock -r

Friday 07 July 2017 02:41:59 AM EDT -0.508323 seconds

[root@ip-172-31-6-98 ec2-user]# ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

[root@ip-172-31-6-98 ec2-user]# date

Thu Jul 6 02:43:42 EDT 2017

[root@ip-172-31-6-98 ec2-user]#

Internet Explorer SSL VPN troubleshoots

Tools -> Internet Options -> Security -> Trusted Sites
Move to low
Disable protected mode
Click sites then add the SSL VPN page to be a trusted member
While adding the trusted site, uncheck "Require server verification for all sites on this zone"


Tools -> Internet Options -> Advanced -> Security section
Enable "Allow sofware to run or install even if the signature is invalid"

Additionally, you should download the Microsoft Visual C++ Distribution 2010 and ensure you're running the latest version of Java.


Add the ASA as a Trusted Site

When you access the ASA in Internet Explorer, you will receive a certificate error if the site is not included as a trusted site.

Complete these steps in order to add the ASA as a trusted site:

  1. In Interent Explorer, choose Tools > Internet Options.

  2. Click the Security tab, and choose Trused sites.


Mysql root password reset

sudo /etc/init.d/mysql stop

Now start up MySQL in safe mode, so you'll skip the privileges table:

sudo mysqld_safe --skip-grant-tables &

Login with root:

mysql -uroot

And assign the DB that needs to be used:

use mysql;

Now all you have to do is reset your root password of the MySQL user and restart the MySQL service:

update user set authentication_string=password('1111') where user='root';  flush privileges;

quit and restart MySQL:

quit  sudo /etc/init.d/mysql stop  sudo /etc/init.d/mysql start

NTFS mount in linux box

  • yum install wget

  • yum install gcc*

  • tar -xvf ntfs-3g_ntfsprogs-2017.3.23.tgz

  • chmod 777 -R ntfs-3g_ntfsprogs-2017.3.23

  • cd ntfs-3g_ntfsprogs-2017.3.23

  • ./configure

  • make

  • make install

  • mount -t ntfs-3g /dev/sdb2 /mnt/


Timezone setting in Linux

ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime



Ubuntu Static IP configuration for Server

auto lo

iface lo inet loopback


# The primary network interface

auto enp4s0

iface enp4s0 inet static

address 192.168.168.129

netmask 255.255.255.0

network 192.168.168.0

broadcast 192.168.168.255

gateway 192.168.168.168

dns-nameservers 192.168.168.103 192.168.168.250

# dns-* options are implemented by the resolvconf package, if installed

dns-search techsol.com

visual studio 2017 startup unknown issue

If you are updating, in order for this to work you MUST delete C:\Users\<your user>\AppData\Local\Microsoft\VisualStudio\15.0_[somenumber]\privateregistry.bin.

Vsphere free license limitation

Free version Hypervisor (Esxi) Version 6.0

2 (physical) CPU limit

No Ram limit (removed since 5.5)

Hypervisor Spec

Number of cores per physical CPU: No limit

Number of physical CPUs per host: No limit

Number of logical CPUs per host: 480

Maximum vCPUs per virtual machine: 8

webfilter fortiguard blocking error

FG100 # show full webfilter fortiguard

config webfilter fortiguard

set cache-mode ttl

set cache-prefix-match enable

set cache-mem-percent 2

set ovrd-auth-port-http 8008

set ovrd-auth-port-https 8010

set ovrd-auth-port-warning 8020

set ovrd-auth-https enable

set warn-auth-https enable

set close-ports disable

set request-packet-size-limit 0

set ovrd-auth-hostname ''

set ovrd-auth-cert "Fortinet_Firmware"

end


FG100

Unknown action 0


FG100 # config webfilter fortiguard


FG100 (fortiguard) # set ovrd-auth-port-warning 58020


FG100 (fortiguard) # exit

please use 'end' to return to root shell


FG100 (fortiguard) # end


FG100 # show full webfilter fortiguard

config webfilter fortiguard

set cache-mode ttl

set cache-prefix-match enable

set cache-mem-percent 2

set ovrd-auth-port-http 8008

set ovrd-auth-port-https 8010

set ovrd-auth-port-warning 58020

set ovrd-auth-https enable

set warn-auth-https enable

set close-ports disable

set request-packet-size-limit 0

set ovrd-auth-hostname ''

set ovrd-auth-cert "Fortinet_Firmware"

end


FG100

config webfilter fortiguard

set cache-mode ttl

set cache-prefix-match enable

set cache-mem-percent 2

set ovrd-auth-port-http 8008

set ovrd-auth-port-https 8010

set ovrd-auth-port-warning 58020

set ovrd-auth-https enable

set warn-auth-https enable

set close-ports disable

set request-packet-size-limit 0

set ovrd-auth-hostname ''

set ovrd-auth-cert "Fortinet_Firmware"

end


FG100 # config webfilter fortiguard


FG100 (fortiguard) # set ovrd-auth-port-http 58008


FG100 (fortiguard) # set ovrd-auth-port-https 58010


FG100 (fortiguard) # end


FG100 # show full webfilter fortiguard

config webfilter fortiguard

set cache-mode ttl

set cache-prefix-match enable

set cache-mem-percent 2

set ovrd-auth-port-http 58008

set ovrd-auth-port-https 58010

set ovrd-auth-port-warning 58020

set ovrd-auth-https enable

set warn-auth-https enable

set close-ports disable

set request-packet-size-limit 0

set ovrd-auth-hostname ''

set ovrd-auth-cert "Fortinet_Firmware"

end

X11 packages to support X forwarding on RHEL 7

# yum install "@X Window System"

OR

# yum install xorg-x11-xauth xorg-x11-fonts-* xorg-x11-utils

OBIEE 11g Startup Script

​#!/bin/bash

# File: /etc/init.d/obiee

# Purpose: Start and stop Oracle Business Intelligence 11g components.

# chkconfig: 2345 99 10

# description: Manage OBIEE service.

# These values must be adapted to your environment.


ORACLE_OWNR=obiee11g                                          # Local Unix user running OBIEE

ORACLE_FMW=/opt/app/Middleware11g                      # Deployment root directory

BIEE_USER=weglogic                                                # BIEE administrator name

BIEE_PASSWD=Admin@123                                      # BIEE administrator password

BIEE_DOMAIN=bifoundation_domain1                        # Domain name

BIEE_INSTANCE=instance1                                      # Instance name

BIEE_SERVER=bi_server1                                        # Server name

BIEE_MANAGER_URL=192.168.168.27:7001             # Admin server URL (hostname:port)


# These should require no change.


WL_PATH=$ORACLE_FMW/wlserver_10.3/server/bin

BIEE_PATH=$ORACLE_FMW/user_projects/domains/$BIEE_DOMAIN/bin

ORACLE_INSTANCE=$ORACLE_FMW/instances/$BIEE_INSTANCE


export ORACLE_INSTANCE


START_LOG=/var/log/obiee-start.log

STOP_LOG=/var/log/obiee-stop.log

SUBSYS=obiee


start()

{

echo "********************************************************************************"

echo "Starting Admin Server on $(date)"

echo "********************************************************************************"

su $ORACLE_OWNR -c "$BIEE_PATH/startWebLogic.sh" &

wait_for "Server started in RUNNING mode"

echo "********************************************************************************"

echo "Starting Node Manager on $(date)"

echo "********************************************************************************"

su $ORACLE_OWNR -c "$WL_PATH/startNodeManager.sh" &

wait_for "socket listener started on port"

echo "********************************************************************************"

echo "Starting Managed Server $BIEE_SERVER on $(date)"

echo "********************************************************************************"

su $ORACLE_OWNR -c "$BIEE_PATH/startManagedWebLogic.sh $BIEE_SERVER http://$BIEE_MANAGER_URL" &

wait_for "Server started in RUNNING mode"

echo "********************************************************************************"

echo "Starting BI components on $(date)"

echo "********************************************************************************"

su $ORACLE_OWNR -c "$ORACLE_INSTANCE/bin/opmnctl startall"

echo "********************************************************************************"

echo "OBIEE start sequence completed on $(date)"

echo "********************************************************************************"

}


stop()

{

echo "********************************************************************************"

echo "Stopping BI components on $(date)"

echo "********************************************************************************"

su $ORACLE_OWNR -c "$ORACLE_INSTANCE/bin/opmnctl stopall"

echo "********************************************************************************"

echo "Stopping Managed Server $BIEE_SERVER on $(date)"

echo "********************************************************************************"

su $ORACLE_OWNR -c "$BIEE_PATH/stopManagedWebLogic.sh $BIEE_SERVER t3://$BIEE_MANAGER_URL $BIEE_USER $BIEE_PASSWD"

echo "********************************************************************************"

echo "Stopping Node Manager on $(date)"

echo "********************************************************************************"

pkill -TERM -u $ORACLE_OWNR -f "weblogic\\.NodeManager"

echo "********************************************************************************"

echo "Stopping Admin Server on $(date)"

echo "********************************************************************************"

su $ORACLE_OWNR -c "$BIEE_PATH/stopWebLogic.sh"

echo "********************************************************************************"

echo "OBIEE stop sequence completed on $(date)"

echo "********************************************************************************"

}


wait_for() {

res=0

while [[ ! $res -gt 0 ]]

do

res=$(tail -5 "$START_LOG" | fgrep -c "$1")

sleep 5

done

}


case "$1" in

start)

echo "********************************************************************************"

echo "Starting Oracle Business Intelligence on $(date)"

echo "Logs are sent to $START_LOG"

echo "********************************************************************************"

start &> $START_LOG &

touch /var/lock/subsys/$SUBSYS

;;


stop)

echo "********************************************************************************"

echo "Stopping Oracle Business Intelligence on $(date)"

echo "Logs are sent to $STOP_LOG"

echo "********************************************************************************"

stop &> $STOP_LOG

rm -f /var/lock/subsys/$SUBSYS

;;


status)

echo "********************************************************************************"

echo "Oracle BIEE components status...."

echo "********************************************************************************"

su $ORACLE_OWNR -c "$ORACLE_INSTANCE/bin/opmnctl status"

;;


restart)

$0 stop

$0 start

;;


*)

echo "Usage: $(basename $0) start|stop|restart|status"

exit 1

esac


exit 0

OBIEE 12c startup script

​#!/bin/bash

# chkconfig: 345 99 10

# description: OBIEE auto start-stop script.

# Source function library.

. /etc/rc.d/init.d/functions

OBIEE_HOME=/opt/app/Middleware/db_1

OBIEE_OWNER=obiee

if [ ! -f $OBIEE_HOME/user_projects/domains/bi/bitools/bin/start.sh ]

then

echo "OBIEE startup: cannot start"

exit

fi

case "$1" in

'start')

# Start the OBIEE databases:

echo -n $"Starting OBIEE Service:"

su - $OBIEE_OWNER -c "$OBIEE_HOME/user_projects/domains/bi/bitools/bin/start.sh"

echo "OBIEE is started"

;;

'stop')

# Stop the OBIEE:

su - $OBIEE_OWNER -c "$OBIEE_HOME/user_projects/domains/bi/bitools/bin/stop.sh"

echo "OBIEE is shutdown"

;;

'status')

su - $ORACLE_OWNER -c "$OBIEE_HOME/user_projects/domains/bi/bitools/bin/status.sh"

;;

*)

echo $"Usage: $0 {start|stop|status}"

esac