Fixed path for generated file (no write permission there).
Added cp command on behalf of cm_adm.