Facebooktwittergoogle_plusredditpinterestlinkedinmail

I come accros one use case where I need to run a Linux script every time on system reboot or startup.

Create a new script in /etc/init.d/myscript. Lets consider the below example script.

vi /etc/init.d/myscript

#! /bin/sh

### BEGIN INIT INFO
# Provides:          myupdate
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin

case "$1" in
    start)
        /path/to/update/script
        ;;
    stop|restart|reload)
        ;;
esac

Make it executable.

chmod ugo+x /etc/init.d/myscript

Configure the init system to run this script at startup.

update-rc.d myscript defaults

Once you activated myscript using update-rc.d then the start action will be executed upon boot

How to Run a Linux Script During Reboot or Startup Roopendra Scripting,
I come accros one use case where I need to run a Linux script every time on system reboot or startup.Create a new script in /etc/init.d/myscript. Lets consider the below example script.vi /etc/init.d/myscript #! /bin/sh### BEGIN INIT INFO # Provides: myupdate ### END INIT...
I come accros one use case where I need to run a Linux script every time on system reboot or startup.Create a new script in /etc/init.d/myscript. Lets consider the below example script.vi /etc/init.d/myscript <pre>#! /bin/sh### BEGIN INIT INFO # Provides: myupdate ### END INIT INFOPATH=/sbin:/bin:/usr/sbin:/usr/bincase "$1" in start) /path/to/update/script ;; stop|restart|reload) ;; esac </pre> Make it executable. <pre>chmod ugo+x /etc/init.d/myscript</pre> Configure the init system to run this script at startup. <pre>update-rc.d myscript defaults</pre> Once you activated myscript using update-rc.d then the start action will be executed upon boot
(Visited 21 times, 21 visits today)
Facebooktwittergoogle_pluslinkedinrss