Run shell script at boot time in linux redhat

I want to run one shell script while loading my linux server with redhat.

Below are the steps that I followed to achieve this.

1) I created script / home / user / script / test.sh

    #!/bin/bash
    echo "xyz" >> output

2) I made a script file as an executable using the following command

chmod +x /home/user/script/test.sh

3) I created a file test.shin the directory/etc/init.d

4) I made a soft link to use below command

 ls -s /etc/init.d/test.sh /etc/rc.d/S15test.sh

5) restart the server

Other things I tried are placed below the line inside the /etc/rc.localfile

/bin/sh /home/user/script/test.sh

But still I can not execute the code written inside the file test.sh.

+4
source share
1 answer

RedHat RUNNING , /etc/rc.d/rc.local script.

, rc.local script, , :

set -x

, :

exec 2>/tmp/logfile
+2

Source: https://habr.com/ru/post/1589365/


All Articles