Scripting extraction and compression of files
IMPORTANT NOTE: Please make sure that you set up the cron job "command type" to be Perl to properly execute the shell script (.sh file). Cron jobs that run over 900 seconds (15 minutes) are automatically terminated.
Compressing
If you're scripting file compression, create a file named "compress.sh" to start.
Zip compression
To compress the file to zip format, add these lines to the script:
#!/bin/sh zip -9pr /PATH/TO/FILES/file.zip /PATH/TO/FILES/
Where "file.zip" is the name that you assign to the zip file
Tar compression
Put this in the script to compress in tar format:
#!/bin/sh tar -cpvf /PATH/TO/FILES/file.tar /PATH/TO/FILES/
Where "file.tar" is the name that you assign to the compressed file.
Tar.gz compression
Put this in the script to compress in tar format:
#!/bin/sh tar -zcpvf /PATH/TO/FILES/file.tar.gz /PATH/TO/FILES/
Where "file.tar.gz" is the name that you assign to the compressed file.
Extracting
If you're scripting file extraction, create a file named "decompress.sh" to start.
Zip extraction
Add these lines to decompress from zip format:
#!/bin/sh unzip -o PATH/TO/FILES/file.zip -d PATH TO FILE/FOLDER
Where "file.zip" is the name that you assign to the zip file.
(NOTE: the -o option will force overwrite existing files!)
Tar extraction
Put this in the script to extract from tar format:
#!/bin/sh tar -xvf /PATH/TO/FILES/file.tar
Where "file.tar" is the name that you assign to the compressed file.
Tar.gz extraction
Put this in the script to extract from tar format:
#!/bin/sh tar -zxvf /PATH/TO/FILES/file.tar.gz
Where "file.tar.gz" is the name that you assign to the compressed file.
NOTE: please take into account that "PATH/TO/FILES" needs to be replaced with your Web directory ie: /mnt/stor1-wc2-dfw1/446266/www.domain.net/web/content/
English
Italiano