
우분투 14.04를 사용하고 있습니다. 루트로 로그인한 상태에서 다른 명령(postgres)으로 명령을 실행해 보았습니다. 그러나 실패했다
root@remotebox:/home/rails/myproject# su - postgres 'pg_upgradecluster 9.3 main'
-su: pg_upgradecluster 9.3 main: No such file or directory
내가 뭘 잘못했나요?
답변1
'pg_upgradecluster 9.3 main'
postgres 사용자의 기본 쉘에 전달하려고 합니다 . postgres 사용자 구성에 따라 이는 'pg_upgradecluster 9.3 main'
postgres PATH에서 파일을 실행하는 것을 의미할 수 있으며, 이것이 "해당 파일 또는 디렉터리 없음" 오류가 발생하는 이유입니다.
인수를 명령(-c)으로 전달해 보세요.
su - postgres -c 'pg_upgradecluster 9.3 main'
쉘로서:
su - postgres -s /path/to/pg_upgradecluster -- 9.3 main
또는 명시적으로 셸을 선택합니다.
su - postgres -s /bin/bash -- -c 'pg_upgradecluster 9.3 main'