3

Is it possible to run only a part of the bash script on startup of ubuntu server? if so how can I achieve this?

1
  • Editing it? depends on the bash script - which one are you referring to?
    – Wilf
    Nov 23, 2015 at 19:00

2 Answers 2

1

You can do it by

. /path_to_script/script_name; proc_name
0

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.

1
  • 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
    – barthr2
    Nov 23, 2015 at 20:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .