factor out command line so the daemon can use it too