Added error propagation. Used pipes instead of temporary file on /usb_tmp and therefore removed everything related to it. Made code general for a list of devices given in conf.d.