buy tb-500

Author Archive

Create database in cPanel using linux command line

Saturday, December 3rd, 2022

1-
uapi --user=alsalamaco Mysql create_user name=alsalamaco_aabbcc password=1qa2ws3ed

2-

uapi --user=alsalamaco Mysql create_user name=alsalamaco_aabbcc password=1qa2ws3password=1qa2ws3eded

3-
uapi --user=alsalamaco Mysql set_privileges_on_database user=alsalamaco_aabbcc database=alsalamaco_aabbcc privileges=ALL%20PRIVILEGES

note: alsalamaco is cpanel domain username

sed to find and replace in file (in linux)

Wednesday, November 30th, 2022

sed -i” -e ‘s/alayan\.co/al\-ayan\.com/g’ alayan_wp.sql

journalctl commands to check the logs

Thursday, November 17th, 2022

Time Ranges

To see messages logged within a specific time window, we can use the --since and --until options. The following command shows journal messages logged within the last hour.

$ journalctl --since "1 hour ago"

To see messages logged in the last two days, the following command can be used.

$ journalctl --since "2 days ago"

The command below will show messages between two dates and times. All messages logged on or after the since parameter and logged on or before the until parameter will be shown.

$ journalctl --since "2015-06-26 23:15:00" --until "2015-06-26 23:20:00"

For greater accuracy, format the date and time as “YYYY-MM-DD HH:MM:SS”. You can also use any format that follows the systemd.time specification.

Docker deletes all containers that have a status of exited

Monday, November 7th, 2022

docker rm $(docker ps -a -q -f status=exited)

or

docker container prune

the two commands are same, the latest one is the newest one. in the new version of Docker

This command deletes all containers that have a status of exited. In case you’re wondering, the -q flag, only returns the numeric IDs and -f filters output based on conditions provided. One last thing that’ll be useful is the --rm flag that can be passed to docker run which automatically deletes the container once it’s exited from. For one off docker runs, --rm flag is very useful.

HTTP response status codes

Saturday, October 15th, 2022

Create a pod called httpd using the image httpd:alpine in the default namespace. Next, create a service of type ClusterIP by the same name (httpd). The target port for the service should be 80.

Saturday, October 15th, 2022

$kubectl run httpd –image=httpd:alpine –port=80 –expose

Create a new pod called custom-nginx using the nginx image and expose it on container port 8080.

Saturday, October 15th, 2022

$kubectl run custom-nginx –image=nginx –port=8080

Create a service redis-service to expose the redis application within the cluster on port 6379.

Saturday, October 15th, 2022

$kubectl expose pod redis –port=6379 –name redis-service

Deploy a redis pod using the redis:alpine image with the labels set to tier=db

Saturday, October 15th, 2022

Run the command to generate the definition file:

$kubectl run redis --image=redis:alpine --dry-run=client -oyaml > redis-pod.yaml

---
apiVersion: v1
kind: Pod
metadata:
  labels:
    tier: db
  name: redis
spec:
  containers:
  - image: redis:alpine
    name: redis
  dnsPolicy: ClusterFirst
  restartPolicy: Always

Then run the command: kubectl create -f redis-pod.yaml to create the pod from the definition file.

OR Use the imperative command: –

$kubectl run redis -l tier=db --image=redis:alpine

Kubernetes imperative commands

Saturday, October 15th, 2022

note: there is no space between – – in the below commands

$kubectl run – -image=nginx nginx

$kubectl create deployment – -image=nginx nginx

$kubectl expose deployment nginx – -port 80

$kubectl edit deployment nginx

$kubectl scale deployment nginx – -replicas=5

$kubectl set image deployment nginx nginx =nginx:1.18