Answer the question
In order to leave comments, you need to log in
How to unzip a file on a remote server?
I am writing a script that sends an archive with databases to the server, and unpacks it there. But I can not correctly write the unpacking.
tar -zcvf ./$fileName $dbsDir
scp ./$fileName [email protected]$server:/home
# Не работает. Просто пример
ssh [email protected]$server 'cd /home && tar xvf $fileName'
Answer the question
In order to leave comments, you need to log in
Both implementations work:
ssh [email protected]$server << ENDSSH
cd /home && tar xvf $fileName
ENDSSH
ssh [email protected]$server << ENDSSH
tar xvf /home/$fileName -C /home
ENDSSH
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question