Home
> Executing Our Own Shell Script, Shell Script > Executing Our Own Shell Script When OS Booting in Debian
Executing Our Own Shell Script When OS Booting in Debian
Write a shell script.
To Open the folder with super user permission
#! /bin/sh
sudo nautilus
save the file as sample.sh
Make sample file as executable
chmod a+x sample.sh
Copy the file into init.d folder
sudo cp sample.sh /etc/init.d/
check which is default runlevel
sudo vi /etc/inittab
# The default runlevel.
id:2:initdefault:
This means your default run level is 2.
Give the link to to the default run level
ln /etc/init.d/sample.sh /etc/rc2.d/S10sample
why i gave the link rc2.d, because of the default runlevel is 2 so i gave the link to rc2.d.
In S10sample ‘ S ‘ is mandatory 10 is number u can give your own number from 10 to 99
After that update rc by following code
sudo update-rc.d sample defaults
Categories: Executing Our Own Shell Script, Shell Script
chmod, shell script, sudo
thanks
LikeLike