Executing several bash scripts in succession

Hi,

I am new to shell programming. I am trying to automate setting up a network using several scripts. Some of the scripts require to reboot in order to continue with the setup. Is it possible to enter another script as soon as the system reboots. Also, if the last line of the script is bash "anotherscript.sh" will "anotherscript.sh" start up ?

Thanks in advance.

Hi, on which operation system do you want to run the script?

Hi research3,

I am running the script on Ubuntu.

Hi, do you want to start a secondary.sh script from you fist.sh script or to assign all the variables in the secondary.sh script?

Hi,

I want to start a new script (execute a new bash file).

if you want to start a bash script between you pc reboot than you have to create or to move it in the right folder.
For Ubuntu is that
/etc/rc0.d/

you can also create it in your home directory an then create in the directory /etc/rc0.d/ a symbolic link

cd /home/user
touch bash.sh
cd /etc/rc0.d/
ln -s S01backup /home/user/bash.sh

I guess that's all!

Hi research3,

Thanks so much. But I dont understand it completely.

Suppose I have 2 scripts "1.sh" and "2.sh" and "1.sh" needs to restart then I should place "2.sh" in /etc/rc0.d/ .... Am I correct? .... and the last line in "1.sh" needs to be "bash 2.sh" ?

Thanks a lot

No 2.sh don't need to include in the fisrt 1.sh script.
And also the first script 1.sh don't need to include in the secondary 2.sh!
just if you want but not necessary!
If you machine is going down or reboot then all scripts will be execute in the directory /etc/rc0.d/
You can also restart you server/pc manually!
I'm not sure just in one thing "if you script have to be beginning with S0"
But that's all