[CLC-506] [CLC-741] Add init.d script; push more logic into bash scripts