Is it possible to run only a part of the bash script on startup of ubuntu server? if so how can I achieve this?
2 Answers
Which bash script are you referring to? Are you looking at a particular script that you want to behave a certain way?
If you have a script that accepts arguments you can specify an argument which might route through a certain part of the script.
Other than that, if you start a script it will perform what it was set to do and run according to it's program unless it happens to encounter an error and crash.
A function is virtually a routine. A script might branch to certain functions according to conditions of the purpose of the scrip. If you have a script to perform functions on files which might include creating temporary space (directories of files) for processing the files, it might also have a routine (function) to clean the workspace or temporary file. It may be designed not to run the cleanup function if it didn't find any files to process.
Other than running the script according to hit's design, you'd have to actually edit the script and make modifications to have it operate or skip the functions you don't want to have it run.
-
actually i've made a workaround with creating an if which checks if some file exists, than adding it in the boot. Thanks for your information, this was very helpful– barthr2Nov 23, 2015 at 20:15