How to run a cron job in Linux?

There are a lot of tasks on the server and Linux level which you have to set and do regular bases and for that Linux offers you a cron job feature in this article we will learn How to run a cron job in Linux?

What is a cron job?

A cron job is a Linux utility that allows you to schedule a command or script to be executed automatically at a specified time and date. Cron is a daemon that runs in the background and checks a configuration file called a crontab for scheduled tasks. When a task is scheduled, cron executes the command or script specified in the task.

Cron jobs are commonly used to automate system maintenance tasks, such as backing up databases or log files, sending emails, and running system updates. They are also used to schedule recurring tasks, such as fetching data from a remote server or running a report.

To create a cron job, you need to create a crontab file and specify the time and date when the job should be run, as well as the command or script to be executed. The crontab file uses a specific syntax, which consists of five fields separated by spaces. The fields represent the minute, hour, day of the month, month, and day of the week when the job should be run. You can use asterisks to specify that the job should be run at any time within a given field. For example, an asterisk in the hour field means that the job will be run every hour.

How to run a cron job in Linux?

To run a cron job in Linux, you can use the crontab command to set up a cron job.

  1. Open a terminal and type crontab -e to edit the crontab file. This will open the crontab file in a text editor.
  2. Add a line to the file with the following format:
* * * * * command_to_execute

The asterisks represent the following:

  • The first asterisk represents the minute of the hour (0-59).
  • The second asterisk represents the hour of the day (0-23).
  • The third asterisk represents the day of the month (1-31).
  • The fourth asterisk represents the month of the year (1-12).
  • The fifth asterisk represents the day of the week (0-6, where 0 is Sunday).

For example, to run a command at 5:00 AM every day, you would use the following line:

0 5 * * * command_to_execute
  1. Save and close the crontab file. The cron job will now run at the specified time.

Note: The crontab file uses a specific syntax, and it is important to follow it carefully. The incorrect syntax can cause the cron job to fail. For more information about the crontab syntax, you can use the man crontab command to view the manual pages.

Read more: How to Choose a hosting provider smartly?

Here you can read How to log in to the Rainloop admin dashboard?

Read More: How to Change Upload limit On CyberPanel?

How to Change Upload limit On CyberPanel?

You can follow us on Facebook too.

How to Change PHP CLI Version

Welcome back! Many of you are wondering how to change PHP CLI version. In this short article, we will be looking at this.

First, let’s check the current version of PHP. Type in the command:

php --version
PHP Current Version

As you can see, I am currently running PHP v7.4.25.

Change PHP CLI Version

Now let’s change our PHP version but first of we need to know what other versions we can use. To know that type in the terminal:

ls /usr/local/lsws/
Listing PHP Versions

We have four versions available i.e PHP 7.2, 7.3 7.4, and 8.0. I will be changing it to 8.0.

Now to do that, you need to copy the binary of the version you want to use to the user’s binary. Now type in the following command:

 cp /usr/local/lsws/lsphp80/bin/php /usr/bin/

Change the lsphp80 to any version you want and hit enter. After that, check the PHP version again and you’ll see the version is changed.

Changed PHP CLI Version

Read our other articles;

Here you can read How to log in to the Rainloop admin dashboard?

Read More: How to Change Upload limit On CyberPanel?

How to Change Upload limit On CyberPanel?

You can follow us on Facebook too.

How to change Linux Server PHP version?

Some time the CLI or your server PHP version needs to change. Here in this article, we will discuss how to change Linux Server PHP version.

Welcome back! Many of you are wondering how to change the PHP CLI version. In this short article, we will be looking at this.

First, let’s check the current version of PHP. Type in the command:

php --version
change Linux Server PHP version

As you can see, I am currently running PHP v7.4.25.

Change Linux Server PHP version

Now let’s change our PHP version but first of we need to know what other versions we can use. To know that type in the terminal:

ls /usr/local/lsws/
Listing PHP Versions

We have four versions available i.e PHP 7.2, 7.3 7.4, and 8.0. I will be changing it to 8.0.

Now to do that, you need to copy the binary of the version you want to use to the user’s binary. Now type in the following command:

 cp /usr/local/lsws/lsphp80/bin/php /usr/bin/

Change the lsphp80 to any version you want and hit enter. After that, check the PHP version again and you’ll see the version is changed.

Changed PHP CLI Version

Read more: How to create, delete and manage Child Domains in CyberPanel?

Follow US on Facebook / Twitter Instagram .

How to Uninstall or Remove Broken Package in Linux?

Many times it happens that when you try to uninstall a package you encounter an error and the package cannot be uninstalled. This happens when the package is broken. To overcome this issue, we remove the post files of the package to make things work. in this article we are going to learn how to Remove Broken Package in Linux.

Recently, I was trying to remove the ImunifyAV package but encountered this error. E: Sub-process /usr/bin/dpkg returned an error code (1)

Uninstallation Error

Removing the Post Files

To fix this issue and remove the package successfully, we need to remove the post files manually for this package. But first, we need to see the files for this package. The installation files are usually located at /var/lib/dpkg/info file. Type in the following command and replace the package_name with the name of the package that you want to remove.

How to download Anydesk and how to install Anydesk

sudo ls -l /var/lib/dpkg/info | grep package_name
Remove Broken Package in Linux

In my case, I replaced the package_name with imunify-antivirus. This thing helps me to list all packages of imunify-antivirus. Now we need to remove these files manually. For that, type the command:

sudo mv /var/lib/dpkg/info/package_name.* /tmp

This will move all the post files to the tmp directory in case we need them back for any reason. Once the command executed to remove files. After doing that reinstall the package again without getting any errors.

Don’t forget to run the sudo apt update command after removing the files.

after doing all these just run commands to Remove Broken Package in Linux.

Command to Remove Broken Package in Linux:

$ apt unintsall <package-name> 

After doing all these steps you can run the uninstall command like this given above and get the required results.

Here you can read How to log in to the Rainloop admin dashboard?

Read More: How to Change Upload limit On CyberPanel?

How to Change Upload limit On CyberPanel?

You can follow us on Facebook too.

How to dump Database without Password from Linux Command line?

In this article, I am going to explain How to dump Database without a Password from the Linux Command line?

As we know when someone wants to dump a database from the Linux command line they need a password for the database to dump it. Basically dumping database means exporting the database from the Linux command line.

In a normal way when you want to export a database you need a password for the database to do it. Here is the normal command to dump.

mysqldump -u [user name] -p[password] [database name] > [dump file]

But sometimes people don’t like to give passwords again and again. So here I will tell you how you can do the database dump using a password. To do so just follow the process along with me.

You have to do some configurations on the MySQL configurations to dump the database without a password. You have to set the root user database password in my.cnf file and you can dump a database without a password. To do so first login to your root ssh using an ssh client like bitvise, putty, etc.

Location of my.cnf is different in the case of different operating systems like in the case of Ubuntu it is /etc/mysql/my.cnf and in case of Centos it /etc/my.cnf.

You can open according to your operating system after logging in to root ssh.

How to dump Database without Password from Linux Command line?

No got to my.cnf simply run this command:

sudo nano /etc/mysql/my.cnf

After that paste, this code in the file

[mysqldump]
user=mysqluser
password=secret

user will be root and the password of your root MySQL user.

After doing this just restart MySQL or MariaDB and run any dump command

mysqldump -u root [Database naem] > /dbbackup.sql

Here you can read How to log in to the Rainloop admin dashboard?

Read More: How to Change Upload limit On CyberPanel?

How to Change Upload limit On CyberPanel?

How to resolve 404 error from website internal pages on LiteSpeed/Cyberpanel?

How to resolve 404 error from website internal pages on LiteSpeed/Cyberpanel?

Some time you face 404 error on all internal pages of your website. This often happened when you move your website from one server to any other or change any internal configurations. Here in this article we will tell you How to resolve 404 error from website internal pages on LiteSpeed Cyberpanel.

Without going deep let me tell you the reason for this. This happened due to the permissions or the rewrite rules. As after changes Open litespeed need a restart.

To resolve 404 error from website internal pages on LiteSpeed/Cyberpanel we just have to do 2 steps.

Steps to resolve 404 error from website:

1. Fix permissions.

Login to your cyberpanel on port 8090.

https://<YOURIP>:8090
cyberpanel login

Got to the website->list websites then click on Manage button present in front of your domain which have issue.

Manage Website
Manage Website

Scroll down and find file manager click on it and here you will find fix permissions button click that a green pop up appears.

fix permissions
fix permissions

2. Restart LiteSpeed Webserver

After doing all restart the Open liteSpeed webserver. You can do it two way one through command.

Systemctl restart lsws

.Or go to the Server status-> LiteSpeed status and press restart.

How to resolve 404 error from website internal pages on LiteSpeed/Cyberpanel?

Here you can read How to log in to the Rainloop admin dashboard?

Read More: How to Change Upload limit On CyberPanel?

How to Change Upload limit On CyberPanel?

You can follow us on Facebook too.

How to change time zone on Linux server using command line?

How to change time zone on Linux server using command line?

In this article, we will know How to change time zone on a Linux server using command line. This is a very easy and a few steps process so follow along to change your time zone according to your need.

The Time zone is the standard time for any specific region. The server time zone is a basic and one of the important things. Server time zone set while installing and setup server. Sometimes we need to change our server time zone according to our requirements. There are many ways but here we will go through command line one. This is one of the easy ways while using Linux.

How to check Current TimeZone of your server?

Before changing your server time zone first of all you must know what is the current time zone of your server to do so you just need to run a very simple command. This command is available in all Linux flavors.

open terminal and run:

$ timedatectl
How to check Current TimeZone of your server?

You can see your current time zone of your server.

2. Set / Change Time zone on Linux Server Using Command line:

Before changing your time zone first of all you must have to know about the time zone you want to set. Like if you want to set somewhere in Asia. you must have to know about your region and cit. Now, how you can do it.

For this there is a command to list all time zones:

$ timedatectl list-timezones
List all time zones

Select your required time zone from the list and add it to this cmd.

timedatectl set-timezone “you time zone”

Make sure that you are login from root account if not use sudo with this.

$ sudo timedatectl set-timezone <your specific time zone>
set time zone

After running this run the timedatctl again and verify if time zone updated or not.

$ timedatectl

Now you can see time zone that you set using above methode.

NOTE: Time zone is one of the core important things many features and services depend upon it so before doing anything make sure that you understood all. moreover, you just need a reboot to apply a new time zone on all servers.

Here you can read How to log in to the Rainloop admin dashboard?

Read More: How to Change Upload limit On CyberPanel?

How to Change Upload limit On CyberPanel?

You can follow us on Facebook too.

How to Access Rainloop Webmail in CyberPanel?

A lot of CyberPanel user uses Rainloop to handle their email. Rainloop is an internal email solution with CyberPanel. Here in this article, we will discuss how you can access Rainloop webmail in CyberPanel?

Rainloop is an efficient memory webmail solution. it is a fast, simple, and modern web-based client email client. Rainloop is the email solution that comes with CyberPanel. It has an amazing user interface. Not only the interface also works great as any other email services.

This article is specifically about access rain loop webmail in CyberPanel.

Follow these steps Access Rainloop Webmail in CyberPanel:

Login you CyberPanel:

First of all, you need to log in to the CyberPanel dashboard. For this, you must have a username and password (admin or non-admin). Visit your the server IP or hostname with port 8090 to login to cyberpanel.

https://<ip/hostname>:8090
CyberPanel Login

2. Create and Email to Login:

Here you can read How to create email account. After creating mail keep these records so you can use to login.

3. Access WebMail:

To access webmail simple go to the Email->Access WebMail. you will be redirected to the link:

https://<IP/Hostname>:8090/rainloop/index.php

provide your email and password to login.

How to Access Rainloop Webmail in CyberPanel?
How to Access Rainloop Webmail in CyberPanel?

4. Rainloop Admin settings:

if you want to change Language, Layout, Default Text Editor, Message on Page, Notifications, etc settings. Login into rainloop admin dashboard and change there.

Here you can read How to log in to the Rainloop admin dashboard?

Read More: How to Change Upload limit On CyberPanel?

How to Change Upload limit On CyberPanel?

How to force redirect HTTP to HTTPS website in CyberPanel?

In this article we will tell you how to force redirect HTTP to HTTPS website in CyberPanel?

What is HTTP?

HTTP stand foe Hypertext Transport Protocol. When you enter http:// in your address bar in front of domain, it tells the browser to connect over HTTP. HTTP use TCP(Transmission control protocol), generally over port 80, to send and receive data packets over ther web.

What is HTTPS?

HTTPS stands for Hypertext Transfer Protocol Secure (also referred to as HTTP over TLS or HTTP over SSL). When you enter https://in your address bar in front of the domain, it tells the browser to connect over HTTPS. Generally sites running over HTTPS will have a redirect in place so even if you type in http:// it will redirect to deliver over a secured connection. HTTPS also uses TCP (Transmission Control Protocol) to send and receive data packets, but it does so over port 443, within a connection encrypted by Transport Layer Security (TLS).

Redirect from HTTP to HTTPS

if you forcefully redirect your website HTTP to HTTPS in Cyberpanel, you will need to add a rewrite rule to that website in order to have it automatically forward to HTTPS instead of HTTP.

In CyberPanel you can forcefully redirect HTTP to HTTPS website using rewrite rules.

To add this:

Force redirect HTTP to HTTPS website in CyberPanel:

  1. Select Websites on the left menu
force redirect HTTP to HTTPS website in CyberPanel

2. Choose the SSL enabled website from the list

force redirect HTTP to HTTPS website in CyberPanel

3. Select “Rewrite Rules” in the Configuration section

force redirect HTTP to HTTPS website in CyberPanel

4. Copy and paste the following code:

force redirect HTTP to HTTPS website in CyberPanel
rewriteCond %{HTTPS} !on
rewriteCond %{HTTP:X-Forwarded-Proto} !https
rewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

5. Now just save your changes, and you’re done!

After doing this on OpenLiteSpeed you must have to restart your webserver. Beacuse OLS need to restart to read the rewrite rules properly.

How to add ZeroSSL on your site? Free SSL for your website?

Read More: How to Change Upload limit On CyberPanel?

How to Change Upload limit On CyberPanel?

How to install OpenLiteSpeed on Centos?

Do you know how to install OpenLiteSpeed on Centos?

First of all, I would like to tell you that what is OpenLiteSpeed? I know most of you know that what is OpenLiteSpeed but it’s my habit to discuss things before going to deep. So OpenLiteSpeed is the Open Source edition of LiteSpeed Web Server Enterprise.

In this article, we will discuss step by step how to install OpenLiteSpeed on Centos.

How To Install OpenLiteSpeed:

First of all, you need to add the LiteSpeed repository to your centos. You can do it by using the following command.

rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el7.noarch.rpm

Once you added the repository now you can install the OpenLiteSpeed on your server easily. To do so you have to run the command:

yum install openlitespeed

Now what? if you want to install any specific version of OpenLiteSpeed. In that case you can use this command:

yum install openlitespeed-x.x.x

Replace the x value with your required version. Like 1.6.5 or something. You can access the web server on:

http://your_ip:7080

Setup Administrator Password:

Now your LiteSpeed web server is installed. You have to set a password for the OpenLiteSpeed web server in order to access it. You can set the password by using this command:

/usr/local/lsws/admin/misc/admpass.sh

Use sudo if you don’t have root rights. you can also use this to change the OpenLiteSpeed web server password. When you run this command this will ask you User name [admin]: put admin here

OpenLiteSpeed web server password

And after that, it will ask for a password add a password and confirm that.

change OpenLiteSpeed web server password

Now your web server is go to go.

Some common commands for OpenLiteSpeed:

Here some common commands that you must need to know about the OpenLiteSpeed.

  1. To check the status of OpenLiteSpeed you can use this command.
Systemctl status lsws 

2. To stop the OpenLiteSpeed service use this command.

Systemctl stop lsws 

3. To start the OpenLiteSpeed service use this command

Systemctl start lsws 

4. To restart the OpenLiteSpeed service use this command

Systemctl restart lsws 

Directories and Logs for OpenLiteSpeed:

Now I think it’s very important to tell you about directories and logs of OpenLiteSpeed. Maybe you want to do some testing on it. Joke apart never try to do tests on anything you have not enough knowledge.

The default OpenLiteSpeed installation directory is: /usr/local/lsws

You can also start OLS using this command:

/usr/local/lsws/bin/lswsctrl start

You can also stop OLS using this command:

/usr/local/lsws/bin/lswsctrl stop

If you faced any error on OLS and want to find what is that then you can check the error log in /usr/local/lsws/logs/error.log.

Some more information about OpenLiteSpeed:

Well, the free version of LiteSpeed web servers. Although both OpenLiteSpeed and LiteSpeed ENT. are developed by the same developers. But there must be some difference between them. You can imagine a price thing and a paid thing must be different from each other.

OpenLiteSpeed has almost all the features that LiteSpeed Ent have. But there must be some difference. The main difference is OpenLiteSpeed requires a restart to load any new .htaccess file. While LiteSpeed Ent does this Automatically.

How to Install a WordPress Plugin?

How to Install CyberPanel On Centos?

How to install CyberPanel? I know everyone who came on this article will know that what is CyberPanel and want to know how to install CyberPanel. Some of you have basic knowledge and some are experts hehe.

But If you are totally new here then let me tell you that CyberPanel is a control panel. Basically, CyberPanel is a hosting control panel like the other popular one c-panel.

How to Install CyberPanel On Centos?

Introduction of CyberPanel:

CyberPanel is a free and open-source next-generation hosting control panel. CyberPanel is Powered by LiteSpeed technologies. And mostly used by the LiteSpeed web servers. Basically CyberPanel is free but here is the twist. CyberPanel has two versions CyberPanel and CyberPanel Enterprise. There is not a huge difference between the CyberPanel and Cyber Panel Ent. CyberPanel Ent comes with LiteSpeed Ent so that makes the difference. See here what the official website of Cyberpanel said about CyberPanel ent.

Here in this article, I am going to tell you how to install CyberPanel on Centos. I will discuss about the installation on other Operating systems and flavors of Linux but in this, I will stay with Centos.

Requirements for installation (Hardware and General requirements ):

CyberPanel requirements for installation are not so high and complicated. We discuss the main here:

  1. A server or machine with Centos
  2. Minimum 1 GB Ram
  3. SHH access with root
  4. 10GB Disk Space.

How to install CyberPanel?

CyberPanel Installation is very easy and its just one command installation. When you search for how to install cyberpanel you will foun a bunch of commands and different steps. But i perfer only one command to install CyberPanel and that command is:

sh <(curl https://cyberpanel.net/install.sh || wget -O - https://cyberpanel.net/install.sh)    

This will do have for you now you have to take care of some processes while installing CyberPanel. These are

Install Specific Version Of CyberPanel:

Now sometimes you have to install a specific version of CyberPanel. This is a bit tricky. First of all, you have to wget (download) the specific branch of CyberPanel you want to install using this command:

wget https://raw.githubusercontent.com/usmannasir/cyberpanel/<branchname>/cyberpanel.sh

Now you have to assign it executable Permissions. Using this command:

chmod +x cyberpanel.sh

Now execute for installation:

./cyberpanel.sh  

How to Upgrade CyberPanel to the latest version?

How to Change Upload limit On CyberPanel?