HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=16)
-   -   iconv in the ISPConfig chrooted environment (http://www.howtoforge.com/forums/showthread.php?t=26318)

dimas 26th August 2008 13:54

iconv in the ISPConfig chrooted environment
 
Please kindly help to set up iconv to work in the ISPConfig chrooted environment on Debian Etch.

Like with other programs I just added

/usr/bin/iconv

to the APPS line in /root/ispconfig/scripts/shell/create_chroot_env.sh

and then enabled shell access for the site where iconv is needed.

Well, iconv IS copied and that's fine but apparently some libraries are not copied in the process - so when I type "iconv -l" from the user's shell, the list of supported encodings is considerably smaller that the list that I get if I type the same as root.

Please kindly advise what I have to add to "create_chroot_env.sh" in order to get all the available encodings for iconv (most important for me is windows-1251)?

dimas 26th August 2008 16:29

Well, I've solved this problem myself, but another one's cropped up. I'll start with the solution to the first one.

I used

strace iconv -f windows-1251 -t utf-8

as root to check what system calls iconv makes and so discovered that iconv makes use of files in /usr/lib/gconv/

After this it was a simple matter to add

mkdir /usr/lib/gconv

and

cp /usr/lib/gconv/* usr/lib/gconv

to "create_chroot_env.sh"

- so now iconv works in the chrooted environment.

However, there is another problem. I'm using a shell script to download an xml file from another server (the file contains currency exchange rates) and later use it in my flash site (I'm importing this xml file into flash by using XMLConnector, but that's a little beside the point).

I'm using a shell script named (by me) loadxml.sh, it goes like this:

#!/bin/sh

wget -q http://www.(anotherserver).com/XML_daily.xml -O XML_daily.xml
iconv -f windows-1251 -t utf-8 -o /web/kurs.xml XML_daily.xml

I'm using iconv because the original xml file is in windows-1251, and I need utf-8 for flash.

Now the problem. If I just type

./loadxml.sh

from inside the user's shell prompt, the script works as intended.

However, if I make a cron job (by putting "./loadxml.sh" in the "Command:" line from inside ISPConfig), any file downloaded with wget just can't be moved to /web - and I need it there, otherwise I won't be able to access it from flash.

wget itself can't download to /web and even mv doesn't work from cron.

please kindly advise why this is happening...

dimas 26th August 2008 21:52

Well since I'm the administrator of the server, the workaround is to use the regular cron via crontab -e (the shell script works from cron if the crob job is added this way, as root).

However, I'm still extremely interested to know if it's possible to run it successfully from cron of a user's account...


All times are GMT +2. The time now is 06:08.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.