09-02-2010, 12:07 PM
Hi everyone.
With what seems to be a sudden change in the way sv_downloadurl works, I find myself constantly having to upload files to my FastDL server now. Unfortuantely, I don't really have the time to go over there myself and bzip2 every one of them. (Or at least the ones I need to.)
So I created this little shell script, which will compress any file that isn't a .bz2 file into a .bz2.
My server is running pure-ftpd as the ftp server, so I can have this script run whenever a file is uploaded to my server. (The first argument is said file.) You'll have to figure out if your ftp server can do the same thing.
Also, if you don't want it to log anything, just remove the echo lines.
And here it is:
With what seems to be a sudden change in the way sv_downloadurl works, I find myself constantly having to upload files to my FastDL server now. Unfortuantely, I don't really have the time to go over there myself and bzip2 every one of them. (Or at least the ones I need to.)
So I created this little shell script, which will compress any file that isn't a .bz2 file into a .bz2.
My server is running pure-ftpd as the ftp server, so I can have this script run whenever a file is uploaded to my server. (The first argument is said file.) You'll have to figure out if your ftp server can do the same thing.
Also, if you don't want it to log anything, just remove the echo lines.
And here it is:
Code:
#! /bin/sh
if [ awk '/.bz2' $1 ]
then
echo "Weird, $1 is a bz2 file." >> /var/log/autocompress.log
else
bzip2 $1
echo "[$time] $1 has successfully been bzip'd." >> /var/log/autocompress.log
fi