How to Run the .sh File Shell Script In CentOS/RHEL

I have created a shell script with the extension .sh on my linux CentOS server. This script will be scheduled using crontab. Before start to run the crontab for that script, there is important step that we must follow. Otherwise all the created script will not running. We have to set an executable permission for the created script using the chmod command. In unix/linux environment, chmod purpose is to change access permissions for any files or folders.

To change the executable permission on my script called myscript.sh is as below:

    chmod +x myscript.sh
    

or

    chmod 0755 myscript.sh
    

Note : Allow execute permission to everyone explanation as below

    User (rwx) = 4+2+1 = 7
    Group(rx) = 4+1 = 5
    World (rx) = 4+1 = 5
    chmode mode = 0755 
    

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *