Better server and script stop/restart method

Credit: vsilvar
https://github.com/warhawk3407/bgpanel/pull/7