How to set the cron job if my port is going closed then automatic get up can you support

How to set the cron job if my port is going closed then automatic get up can you support

You mean like if TCP port 3306 closed, again open it automatically?

yes
i want to get port up

Are you using systemd based Linux distro? Could you give us more info? What TCP port and service name and Linux/Unix distro name will help you to sort this out quickly.

yes, i am using centos7 and also TCP port

On CentOS 7 you can edit the service file and append the following

Restart=on-failure

So you configures whether the service shall be restarted when the service process exits, is killed, or a timeout is reached.

How to edit the service file?

Run the command

systemctl edit service-name

Then add Restart=on-failure to the config.

Take a look at the following example:

Then call that script from cron

Thanks for your support i will try, can you help me how to install git hub in centos7 and how to create a user.


Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki