use bash builtins instead of forking, add `-l` for logging

- add `-l` for logging on the server
- `sed` and `cut` removed for speed by using bash builtins